In the normal data step, the trick is to stop SAS from returning to the top of the implicit loop. Metadata attributes get defined at compilation time, so you can define variables with formats, labels and lengths without having any records.
Do you want to create blank character variables or numeric variables?
From your first post, I assume you mean numeric variables. SAS uses the period to highlight the missing variable is of type numeric, so other than using a format, I don't think you can change the appearance to a blank in the dataset. However for all reporting/printing purposes, you can use the missing option and set it to blank.
Code:
options missing=' ';
data class ;
set sashelp.class ;
call missing(x,y,z) ;*Create missing numerics x,y,z;
run;
proc report data=class ;
columns _all_ ;
define _all_ / width=10 ;
run;
For characters, a retain is probably the most efficient way:
Code:
data class ;
set sashelp.class ;
retain x y z '';
run;
proc report data=class ;
columns _all_ ;
define _all_ / width=10 ;
run;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.