BookmarkSubscribeRSS Feed
Dyllan
Calcite | Level 5

Hello,

 

I'm trying to create a block randomisation scheme. I've managed to create something very close to what I want, except I would like the subject var to be blank instead of the numbers 1-3. I'm a complete noob when it comes to SAS so any help is much appreciated. I use SAS studo v9.4

 

Many thanks,

 

Dyllan

 

Code:

 

data _null_;
x=round(ranuni(0)*1000000);
call symput ('seed', x);title "3 arm trial randomisation scheme.";
run;
title "3 arm trial randomisation scheme.";
proc plan;
factors block=100 ordered subject=3 ordered/noprint;
treatments treatment=3 random;
output out=out
treatment cvals=('A' 'B' "C");

run;
proc print data=out noobs;
var block treatment subject;

run;

1 REPLY 1
ballardw
Super User

You have at least two possible approaches depending on how you will actually use the the out dataset, change the value which will be data step, or a format so the displayed value is blank.

/* to actually change the value*/
data out1;
  set out; 
  call missing (subject);
run;
/* missing may be represented by other characters than .
   to show blank*/
options missing=' ';
proc print data=out1 noobs;
var block treatment subject;

run;
options missing='.';
/* or use a format to change the display*/
proc format library=work;
value blank
low-high=' '
;
run;
proc print data=out noobs;
   var block treatment subject;
   format subject blank.;
run;

If you are going to do this frequently then the format approach may be preferred if using the proc print output. Otherwise use the data change.

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

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