DATA Step, Macro, Functions and more

PCTL function with a large amount of variables

Reply
Occasional Contributor
Posts: 14

PCTL function with a large amount of variables

Hi,

 

I am using X=PCTL(I,variable1, variable2, variable3....) function to calculate percentiles, but I want to calculate percnetiles among 600 variables. 

 

is there anyway that i can simpelize the expression instead of listing every variable in the bracket?? That would be crazy!

 

Thanks,

Sherri 

 

Super User
Posts: 19,876

Re: PCTL function with a large amount of variables

Do the variables have a naming convention? Are they all side by side?

You could transpose the data and use BY processing as well.
Occasional Contributor
Posts: 14

Re: PCTL function with a large amount of variables

Thank you for you response.
The variables' name look like this: load_2004,load_2005,load_2006,load_2007,load_2008,load_2009, l3r1-l3r100,l4r1-l4r100,l5r1-l5r100,l6r1-l6r100;
I can probably do transpose process, but i am not familiar with that and it will easily mess up my data set. I am still wondering if this can be solved with PCTL function.
Occasional Contributor
Posts: 14

Re: PCTL function with a large amount of variables

Thank you for you response.
The variables' name look like this: load_2004,load_2005,load_2006,load_2007,load_2008,load_2009, l3r1-l3r100,l4r1-l4r100,l5r1-l5r100,l6r1-l6r100;
I can probably do transpose process, but i am not familiar with that and it will easily mess up my data set. I am still wondering if this can be solved with PCTL function.

Super User
Posts: 19,876

Re: PCTL function with a large amount of variables

Variable lists are what you're looking for:
https://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000695105.htm

Why do you think transpose would mess up your dataset?
Occasional Contributor
Posts: 14

Re: PCTL function with a large amount of variables

Thank you for your link. It is helpful.

 

After I tried several list methods, It turnes out the function can be written as x=PCTL(i, of variableSmiley Happy and it worked.

 

The reason I dont prefer transpose process is because I am personally not familiar with it, and the data I am manipulating is very complicated alrealy for me, so in order to keep my logic clear for myself, I prefer this PCTL function.

 

Thank you for your help again!

 

 

 

Ask a Question
Discussion stats
  • 5 replies
  • 391 views
  • 0 likes
  • 2 in conversation