DATA Step, Macro, Functions and more

Macro issue

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 10
Accepted Solution

Macro issue

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);


Accepted Solutions
Solution
‎05-07-2018 09:50 AM
Frequent Contributor
Posts: 142

Re: Macro issue

Posted in reply to Lost_Gary

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


All Replies
Solution
‎05-07-2018 09:50 AM
Frequent Contributor
Posts: 142

Re: Macro issue

Posted in reply to Lost_Gary

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);

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 106 views
  • 0 likes
  • 2 in conversation