BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

I need to create a summary report with all counts.So I created a count for each dataset and together put it on the one dataset,but the output is not so exact if I use the below code,

data summaryReport;
set Var1 Var2 Var3 Var4 ;
run;

Var1 Var2 Var3 Var4
38
0
0
40

I need an output as below,

Var1 38
Var2 0
var3 0
var4 40

Please let me know.
Thanks Message was edited by: Raveenat
3 REPLIES 3
ballardw
Super User
How did you summarize and combine the previous output? You may be creating extra work with that approach.
deleted_user
Not applicable
Hi

I created a count for each dataset by using this macros,

%macro cnt_inv (tbl=, vr=, table=);
PROC SQL;
create table &tbl. as
select count(*) as &vr. from &table.
quit;
%mend cnt_inv;

%cnt_inv (tbl=var1, vr=prior, table=test1);
%cnt_inv (tbl=var2, vr=worked, table=test2);
%cnt_inv (tbl=Var3, vr=new, table=test3)
%cnt_inv (tbl=var4, vr=crnt, table=test4);
Ksharp
Super User
Emmmm.
Maybe you will like dictionary table:


[pre]
proc sql ;
create table summary as
select memname label='Table Name',nobs label='Number of Observations'
from dictionary.tables
where libname='SASHELP' and memname in ('CLASS' 'SHOES');
quit;
[/pre]


Ksharp

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 668 views
  • 0 likes
  • 3 in conversation