BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Sir_Highbury
Quartz | Level 8
Hi Kurt,

thanks for your reply, nice to know the motivations active here, I also
think that helping the other without direct interests is a good training.
But I thought that here, since SAS is not open source, the people are
active in order to be paid.
So are you working in a local data processing division of a large
international insurance company? Which is your focus?

##- Please type your reply above this line. Simple formatting, no
attachments. -##
Kurt_Bremser
Super User

I'm the administrator of the data warehouse server, the main developer, and third-level support.

I'm also the primary contact for our SAS power-users.

My rather rich background in UNIX admin, operating and programming has been of value.

 

Sir_Highbury
Quartz | Level 8
assuming you would do the same within a macro:

data want (drop=country rename=(tmp=country)); length tmp $2000; set have end=last; retain tmp; tmp=catx(",",tmp,country); if last then output; run;

I changed the code as it follows:

data want (drop=&var. rename=(tmp=&var.));
  length tmp $2000;
  set have end=last;
  retain tmp;
  tmp=catx(",",tmp,&var.);
  if last then output;
run;

do you already notice a mistake? Instead of getting the value list I get the variable name....
 

 

Reeza
Super User

What does &avatar resolve to? And what are you getting?

 

I don't see any issues with the code. 

 

PS. I didn't mean any offence with previous response 🙂

Sir_Highbury
Quartz | Level 8

1. I have a macro which is based on the variable &var;

2. A call execute is used;

 

If for istance the &var assume the variable "segment", I did not get as output the values assumed by the variable "segment" but only the name of the variable "segment" itself.

The example works perfectly, but when I switched to the macro I did something wrong. 

 

 

 

Reeza
Super User

I don't have enough info to help. 

 

I think ink this may warrant a new question now, with more details. Usually with call execute it becomes an issue of timing - when it executes versus values that are passed. 

Sir_Highbury
Quartz | Level 8

ok, fair enough. I will keep trying and in case I will post something new.

Tom
Super User Tom
Super User

If you want to use the macro variable to refer to a variable then it needs to contain the NAME of the variable.

%let var=segment;

From the symptom it looks like you have set the macro variable to a value that includes quotes.

 

%let var="segment";

This will be interpreted by regular SAS as a string literal and not the name of a variable.

 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 22 replies
  • 2376 views
  • 8 likes
  • 4 in conversation