- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 03-06-2008 07:53 AM
(39554 views)
Hi, I have a problem defining a label.
The dataset contains a variable called 'Month' formatted as numbers;
when I use the following code:
proc freq data=mylib.history;
table month;
title 'PRoc freq without format';
run;
I get the following output:
PRoc freq without format 227
The FREQ Procedure
Season
Cumulative Cumulative
MONTH Frequency Percent Frequency Percent
__________________________________________________
1 10 8.33 10 8.33
2 10 8.33 20 16.67
3 10 8.33 30 25.00
4 10 8.33 40 33.33
5 10 8.33 50 41.67
However, I'd like to change the name of the column 'Month' by "Active Months". For that; I used the command label:
proc freq data=mylib.history;
table month;
title 'PRoc freq without format';
label month ='Active Months';
run;
However, the label 'month' is not changed, instead, my proposed new lable appears on top of the output, like a title:
Active Months
Cumulative Cumulative
MONTH Frequency Percent Frequency Percent
_______________________________________________
1 10 8.33 10 8.33
2 10 8.33 20 16.67
3 10 8.33 30 25.00
What I'm doing wrong? I also tried adding a label in the DATA procedure, but with the command PROC FREQ, still I got the name of the original variable and the label I want on top of the table, instead of replacing the name of 'month'.
Kind regards
Karolus
The dataset contains a variable called 'Month' formatted as numbers;
when I use the following code:
proc freq data=mylib.history;
table month;
title 'PRoc freq without format';
run;
I get the following output:
PRoc freq without format 227
The FREQ Procedure
Season
Cumulative Cumulative
MONTH Frequency Percent Frequency Percent
__________________________________________________
1 10 8.33 10 8.33
2 10 8.33 20 16.67
3 10 8.33 30 25.00
4 10 8.33 40 33.33
5 10 8.33 50 41.67
However, I'd like to change the name of the column 'Month' by "Active Months". For that; I used the command label:
proc freq data=mylib.history;
table month;
title 'PRoc freq without format';
label month ='Active Months';
run;
However, the label 'month' is not changed, instead, my proposed new lable appears on top of the output, like a title:
Active Months
Cumulative Cumulative
MONTH Frequency Percent Frequency Percent
_______________________________________________
1 10 8.33 10 8.33
2 10 8.33 20 16.67
3 10 8.33 30 25.00
What I'm doing wrong? I also tried adding a label in the DATA procedure, but with the command PROC FREQ, still I got the name of the original variable and the label I want on top of the table, instead of replacing the name of 'month'.
Kind regards
Karolus
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I couldn't figure out how to change the column header within PROC FREQ, but I did come up with this solution. Write the results of your freq procedure to another SAS dataset and print that dataset. With the proper options, you can get the label headers you want. How would this work?
[pre]
proc freq;
table month / out=work.freq outcum;
run;
proc print data=work.freq noobs label;
run;
[/pre]
[pre]
proc freq;
table month / out=work.freq outcum;
run;
proc print data=work.freq noobs label;
run;
[/pre]
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
This Tech Support note explains what needs to happen:
http://support.sas.com/kb/23/350.html
The short explanation is that SAS procedures (like PROC FREQ and PROC MEANS and PROC UNIVARIATE) work in conjunction with a TABLE template in order to produce output (such as LISTING window output or ODS output).
In order to have the LABEL used with PROC FREQ, you have to change the TABLE template that works with PROC FREQ. The Tech Support note contains a code example. If you have problems with the code, then you might consider contacting Tech Support for more help.
cynthia
This Tech Support note explains what needs to happen:
http://support.sas.com/kb/23/350.html
The short explanation is that SAS procedures (like PROC FREQ and PROC MEANS and PROC UNIVARIATE) work in conjunction with a TABLE template in order to produce output (such as LISTING window output or ODS output).
In order to have the LABEL used with PROC FREQ, you have to change the TABLE template that works with PROC FREQ. The Tech Support note contains a code example. If you have problems with the code, then you might consider contacting Tech Support for more help.
cynthia
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you a lot; the recommended solution has solved the problem
Regards
Karl
Regards
Karl