BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Lost_Gary
Obsidian | Level 7

I am struggling the most simple SAS macro code.  for some reason I cannot get this the call the variable income no matter what I try (quotes, removing underscore, etc.).  here is my code.  thanks for your help. 

 

options symbolgen mprint;

data temp;

infile DATALINES dsd missover;

input count income_error;

CARDS;

1, 1,

1, 0,

1, 0,

;

run;

%macro one(pc);

proc means noprint data= temp;

var count &pc_error;

output out= &pc1

sum(count &pc_error) =

;

run;

%mend;

 %one(income);

1 ACCEPTED SOLUTION

Accepted Solutions
Vish33
Lapis Lazuli | Level 10

you have missed '.' to represent the macro variable to correctly. use the below code.

 

%macro one(pc);

 

proc means noprint data= temp;

var count &pc._error;

output out= &pc.1

 

sum(count &pc._error) =

;

run;

%mend;

 

%one(income);

 

View solution in original post

1 REPLY 1
Vish33
Lapis Lazuli | Level 10

you have missed '.' to represent the macro variable to correctly. use the below code.

 

%macro one(pc);

 

proc means noprint data= temp;

var count &pc._error;

output out= &pc.1

 

sum(count &pc._error) =

;

run;

%mend;

 

%one(income);

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

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
  • 1 reply
  • 598 views
  • 0 likes
  • 2 in conversation