BookmarkSubscribeRSS Feed
Markanti
Calcite | Level 5
  1. Create a macro variable called “list” that represents the following variables when referenced: dbirwt nprevist wtgain; 
    1. Create a dataset called “four” from “main” keeping only those variables in this list.  Use the macro variable you created to do accomplish this. 
    2. Next find the means for these same variables using the macro variable.

Unfinished Code

*Lab 12 – Problem 1;

data

run;

proc

run;

I got correct for this.


%let list = dbirwt nprevist wtgain;

data four;
set lab.main;
keep &list;
run;

title "Using a Macro variable list";

proc means data=four mean;
var &list;
run;

 

but for 2nd problem I am getting error

  1. Use the dataset called “four” from the problem above and the macro variable call “list”, from the same problem
    1. Run a Proc Means for all these variables and save the results of this procedure into a new SAS data set called “Save” in the Lab library. 
  1. Add the option noprint right after data= lab.one;

Unfinished Code

*Lab 12 – Problem 2;

proc

run;

 my finished code is

title "Using a Macro variable list";

proc means data=lab.four noprint;
var &list;
run;

but I am getting error as

 ERROR: Neither the PRINT option nor a valid output statement has been given.
Where am I doing wrong??
 
1 REPLY 1

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

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

Browse our catalog!

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