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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 984 views
  • 0 likes
  • 2 in conversation