How would i write the following %sort statement using proc sort?
%sort(data.rade,camp_cd appl_id RADE_RELSHIP_TYP RADE_ACCT_NO,option=nodupkey)
I believe it would be:
proc sort data=data.rade nodupkey;
by camp_cd appl_id RADE_RELSHIP_TYP RADE_ACCT_NO;
run;
Is this correct/will give me the same results? Also, can %sort be used outside of a macro?
Thanks!
%sort would, in SAS, refer to macro code or "is a macro". So "outside of a macro" is pretty meaningless but would be usable. The code could do anything. If you cannot provide the source code of %sort we really can't answer this completely. I don't recognize this is a standard SAS supplied macro so would not even bother to guess.
IF this is SAS code set options MPRINT before executing it. That will show the statements generated by the macro in the log:
options mprint; %sort(data.rade,camp_cd appl_id RADE_RELSHIP_TYP RADE_ACCT_NO,option=nodupkey) options nomprint; /* turn off the option*/
If you have questions about the content of the log then copy ALL the text from the log, open a text box on the forum using the </> icon above the message window and pasting the text.
The text, you can see on above, is important to preserve line formatting as the main message window on this forum is known to reformat pasted text and may move stuff making it harder to understand, especially warnings and error messages.
If %sort is supposed to be from another programming language then you need to tell us what it is supposed to do.
This looks like a macro call to a site specific custom macro and though we can't know what this macro does.
If you use below two options then you'll get in the SAS log what SAS code the macro generates as well as where the macro definition is stored in your environment. That should answer your question - else please share the log created when running below and eventually also the macro definition (the code from the .sas file from the location where the log tells you it found the macro definition).
options mprint mautolocdisplay;
%sort(data.rade,camp_cd appl_id RADE_RELSHIP_TYP RADE_ACCT_NO,option=nodupkey)
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.