data test;
input empno ename$ job$ sal deptno;
datalines;
7788 SCOTT ANALYST 3000.00 20
7902 FORD ANALYST 3000.00 20
7934 MILLER CLERK 1300.00 10
7369 SMITH CLERK 800.00 20
7876 ADAMS CLERK 1100.00 20
7900 JAMES CLERK 950.00 30
7782 CLARK MANAGER 2450.00 10
7566 JONES MANAGER 2975.00 20
7698 BLAKE MANAGER 2850.00 30
7839 KING PRESIDENT 5000.00 10
7499 ALLEN SALESMAN 1600.00 30
7521 WARD SALESMAN 1250.00 30
7654 MARTIN SALESMAN 1250.00 30
7844 TURNER SALESMAN 1500.00 30
;
run;
proc print; run;
proc sort data=test; by deptno; run;
proc freq data=test;
table job/nocum nopercent;
by deptno;
weight sal;
run;
Hi, Can we change the level of column frequency in the result of this programme of can we create a new dataset same as result????
thanks
Hi,
Another way to get the output dataset
please try the below code, here work.freq is the location of the dataset freq in the work library and the per your request frequency is renamed as sum_sal.
ods listing close;
ods output onewayfreqs=work.freq(drop=f_job table rename=(frequency=sum_sal));
proc freq data=test;
table job/nocum nopercent;
by deptno;
weight sal;
run;
ods output close;
ods listing;
Thanks,
Jagadish
Can we change the level of column frequency
Explain further, or better yet, give an example of what you want
OUTPUT result of given code. Desired OUTPUT ...
------- deptno=10 ----- ------- deptno=10 -----
job Frequency job SUM_SAL
CLERK 1300 CLERK 1300
MANAGER 2450 MANAGER 2450
PRESIDEN 500 PRESIDEN 500
----- deptno=20 -------- ------ deptno=20 ---------
job Frequency job SUM_SAL
ANALYST 6000 ANALYST 6000
CLERK 1900 CLERK 1900
MANAGER 2975 MANAGER 2975
--------------so on....like for deptno=30 ------- -------so on....like for deptno=30
and to store it as a dataset like.
deptno job sum_sal
10 CLERK 1300
20 MANAGER 2450
30 PRESIDEN 500
so can we change the label of column name frequency as like sum_sal
Hi,
Another way to get the output dataset
please try the below code, here work.freq is the location of the dataset freq in the work library and the per your request frequency is renamed as sum_sal.
ods listing close;
ods output onewayfreqs=work.freq(drop=f_job table rename=(frequency=sum_sal));
proc freq data=test;
table job/nocum nopercent;
by deptno;
weight sal;
run;
ods output close;
ods listing;
Thanks,
Jagadish
sorry i wrote level ,, i meant label... i want to change the label name of freq column name.
Hi Aman.
I think it quiet easy, you need to manipulate in proc freq like this to achive the output...
proc freq data = test;
tables job / out = test1(rename = (count = sum_sal) drop = percent) nocum nopercent;
by deptno;
weight sal;
run;
And ya by default, SAS will produce the Frequency as column name in Proc Freq output as it is one kind of Statistics that SAS is calculating so as per my knowledge, we cant change the output except you can eliminated the cumilative stat in proc freq but cant change the name of any stat in output...
Thanks,
thanks urvasi...
@Aman4SAS, Welcome...By the way, My name is Urvish not Urvasi...
sincerely apology.....
No Problem, Happy to have discussion with you...
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.