- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I've written a proc univariate to calculate percentiles for a few different metrics. It works great. The problem is the output variable names are the names I've given them concatenated with the percentile amount. So pcap_br95 and so forth. I want to reference these elsewhere in my script, but I don't want to have to change the script in four places, I just want to change the percentile if necessary and run it. So I need to rename the dynamically named variables to something static.
Is there anyway to create a dataset from an existing dataset like this but only by referencing the column number or position?
proc univariate data= percentile_test noprint;
where br > 0;
var br pr k_starts;
;
output out=mk.br_percentile
pctlpts= 95
pctlpre = pcap_br
pctlpre = pcap_pr
pctlpre = pcap_kstarts
run;
I have tried creating another data set, but it requires me to name the original variables.
Thanks in advance for your help.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I don't know if there's a way to do this in PROC UNIVARIATE, but in PROC SUMMARY its simple and the suffix 95 does not get appended to your output variable names.
proc summary data= percentile_test;
where br > 0;
var br pr k_starts;
output out=mk.br_percentile p95 = pcap_br pcap_pr pcap_kstarts;
run;
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I don't know if there's a way to do this in PROC UNIVARIATE, but in PROC SUMMARY its simple and the suffix 95 does not get appended to your output variable names.
proc summary data= percentile_test;
where br > 0;
var br pr k_starts;
output out=mk.br_percentile p95 = pcap_br pcap_pr pcap_kstarts;
run;
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@logistics_00 wrote:
Perfect. Turns out I was asking the wrong question, I should have started with how do I calculate these percentiles. Much appreciated!
For what it may be worth, I tend to think of Proc Univariate as much more of an exploratory procedure to look at lots of information about the variables at one time. If I know that I want to summarize variables then going to the procedures that are more oriented to such like Proc Means, Summary or Freq seems more efficient plus the controls for such naming are more direct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content