BookmarkSubscribeRSS Feed
DanD
Calcite | Level 5
I saw this in a piece of code - %let custsegs = %str('E|002878','E|010208','00002878','E|X02964','E|002964','CS|E|002878','CS|E|010208','OPT_FA|00002878','CS|E|X02964','CS|E|002964');

Can someone tell me what it means?

Thanks,

DanD
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
%STR is one of the SAS Macro Facility quoting functions. The relevant sections of the documentation are here:
http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/tw3514-overvwqt.htm
http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a001061325.htm
http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a001072333.htm
http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a001061345.htm

What will be informative, beyond the doc, is for you to find out WHERE in your code the macro variable &CUSTSEGS is used. For example, if you search for the macro variable in your code, you might find something like this:
[pre]
if WOMBAT in (&custsegs) then do;
... more code ...
[/pre]

which would tell you that the macro variable &CUSTSEGS is used in the IF statement to supply values for the IN operator that is testing the value of the dataset variable WOMBAT. If you then did a PROC FREQ:
[pre]
proc freq data=lib.dataset;
tables WOMBAT;
run;
[/pre]

you would find out whether the values of the WOMBAT variable were correctly specified in the %LET statement inside the %STR function.

Generally speaking any of the Macro Quoting Functions, including %STR are used to mask or hide the normal syntactic meaning of certain special characters, as defined in the documentation. In this instance, I suspect that %STR was used in the %LET statement because someone felt that the single quotes or the pipe symbols needed to be "protected".

cynthia
DanD
Calcite | Level 5
The variable isn't used anywhere in the code that I have. I only have part of the code.

Thanks for your reply.

DanD

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 926 views
  • 0 likes
  • 2 in conversation