As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.
Here are some tips for How to share your SAS knowledge with your professional network.
Generating Zeroes in PROC TRANSPOSE Output
Example (from SAS-L):
proc plan seed=1788047502; factors id = 10 ordered sva = 5 of 10 random y = 1 of 100 ; output out=work.plan; run;
proc transpose data=plan out=sva(drop=_:) prefix=sva; by id; var y; id sva; run;
The output is full of missing values. Suppose they ought to be zeroes.
data sva0; set sva; array ss[*] sva : ; do j = 1 to dim(ss); if ss(j) = . then ss(j) = 0; end; drop j; run;
PROC STDIZE (SAS/STAT)
Suggested in the same SAS-L post:
proc stdize method=mean reponly missing=0 data=work.sva out=sva2; var sva:; run;
Updating a Frame of Zeroes
The strategy is to build an all-zero counterpart of the transposed data set, then use the UPDATE statement to overlay the non-missing values.
data work.frame / view=work.frame; if 0 then set sva; retain sva: 0; set sva(keep=id); run;
data work.zeros1; update work.frame work.sva; by id; run;
An Option in PROC TRANSPOSE?
An option to automatically do the replacement of missing values with zeroes would be welcome.
This only affects the display of the values. It does not change what is stored.
proc format; value zero . = '0'; run; proc datasets nolist; modify plan; format sva : zero.; run; quit;
This too involves display only.