BookmarkSubscribeRSS Feed
anavabi
Calcite | Level 5

In the below SAS code, how can I add a column to the output dataset which includes plot number from 1 to 12? Thanks

proc plan seed=17431;

   factors  Block=3 entry=4 / noprint;

   output out=Test;

run;

3 REPLIES 3
data_null__
Jade | Level 19

How about this?

proc plan seed=17431;
  
factors Block=3 ordered entry=4 random plot=1 of 12 perm / noprint;
  
output out=Test;
   run;
proc print;
  
run;

12-10-2014 2-14-28 PM.png
anavabi
Calcite | Level 5
  1. Thanks. This was helpful. What if I want to add a column with name of the entries, say entry 1 is AA entry 2 is BB, entry 3 is CC and entry 4 is DD. Thanks
data_null__
Jade | Level 19

You can use OUTPUT statement options change ENTRY into a string variable.

proc plan seed=17431;
  
factors Block=3 ordered entry=4 random plot=1 of 12 perm / noprint;
  
output out=Test entry cvals=('AA' 'BB' 'CC' 'DD');
   run;
proc print;
  
run;
12-10-2014 4-23-27 PM.png

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 897 views
  • 0 likes
  • 2 in conversation