You are on the right track, but with the wrong type of DO loop. The regular DO statement belongs to a DATA step program. Since you cannot use PROC UNIVARIATE "inside" a DATA step program, you need to look to other techniques.
The SAS language has a separate syntax to replicate and generate "code blocks" for compilation and execution. That separate syntax belongs to the SAS Macro facility.
It's very useful to run code before posting it for usage by folks who are new to a particular concept, like macro processing. For example, your posted code generates an ERROR message:
463 %DO sv = sv1 sv2 sv3 ;
ERROR: Expected %TO not found in %DO statement. A dummy macro will be compiled.
And, your code snippet implies that %DO can be placed in "open" code, which is not possible. A %DO statement must be used inside a macro program.
Cynthia. The code i wrote is not tested, just show an example.
Yes.You maybe right for new folk it is very helpful to find some information about this
by himself before posting .
And I also sure macro can do it.
Sorry.I think use %scan and %do %while() and %eval() to get that.
Do you really need a do loop? You could get all necessary information by the following code:
proc univariate data=sample0 noprint;
var sv1 sv2 sv3;
output out=nyse pctlpts=30 70 pctlpre=sv1 sv2 sv3;