Hi guys
how to count cars makers list in sashelp.cars using proc report
What have you tried? Why proc report?
count no of car makers list
So you aren't limited to use proc report?
Show us what you tried, so we can point out where you went wrong.
I mean, you did try something, or do you expect that for all your life, others will do your work?
data ds;
set sashelp.cars;
run;
proc sort data=ds;
by make;
run;
data ds2 (keep=make);
set ds;
by make;
if last.make then output;
run;
Hi Kurt_Bremser
I tried but i am looking output in proc report
Then read the documentation of PROC REPORT and start hacking away. You will learn a LOT doing that.
Hint: PROC REPORT provides a statistic (n) that has the count.
Also do a Google search for "sas counting in proc report".
@BrahmanandaRao wrote:
data ds; set sashelp.cars; run; proc sort data=ds; by make; run; data ds2 (keep=make); set ds; by make; if last.make then output; run;
Hi Kurt_Bremser
I tried but i am looking output in proc report
For tasks that are essentially counting, use PROC FREQ, no need to create new data sets and sort the new data sets. All you need is four lines of code (and the first line is really optional, you could leave it out):
ods select nlevels;
proc freq data=sashelp.cars nlevels;
tables make;
run;
If you really really really need it from PROC REPORT, show us what the report should look like.
Hi:
There are several procedures, including PROC FREQ, PROC TABULATE as well as PROC REPORT and PROC SQL that could generate counts for you. 3 of these procedures are shown below -- going from least lines of code to most lines of code:
Cynthia
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.