BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
arunrami
Pyrite | Level 9

Dear All,

 

In the below code, my intention is very simple that I want to report the output table which got generated by PROC APPEND. Its working fine when using proc print but when we are using proc report tool , its generating the sum  of the all the values(all are numeric in existing data set) as a single observation. I am not sure the reason behind this weird behavior of PROC REPORT.

Below attached code and sample output, Please share your thought ....??

 

%macro report;
%do I=1 %to 2;
proc append base=GDW data=dummy.count&I ;
run; 
%end;
%mend;
%report;

proc print data=GDW;
run;

proc report data=GDW;
column _all_;
run;

 

Capture.PNG
1 ACCEPTED SOLUTION

Accepted Solutions
jklaverstijn
Rhodochrosite | Level 12

In case you want to mimic the PROC PRINT output in PROC REPORT you can do this:

 

proc report data=GDW;
   column _all_;
   define _all_ / display;
run;

This prevents the use of the numeric columns as analysis so there will be no statistic applied, just rows with values will be displayed.

 

Regards,-- Jan.

View solution in original post

2 REPLIES 2
jklaverstijn
Rhodochrosite | Level 12

Hi,

 

What you deem weird is the default behaviour of proc report. Numeric variables are analysis variables and the default statistic is SUM.

 

If you need different output, read the docs and add statements for grouping and displaying values, subtotalling and/or

statistics. Keep in mind that REPORT is a very powerful procedure but takes some effort to get the output you desire.

 

Hope this helps,

-- Jan.

jklaverstijn
Rhodochrosite | Level 12

In case you want to mimic the PROC PRINT output in PROC REPORT you can do this:

 

proc report data=GDW;
   column _all_;
   define _all_ / display;
run;

This prevents the use of the numeric columns as analysis so there will be no statistic applied, just rows with values will be displayed.

 

Regards,-- Jan.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 2 replies
  • 1285 views
  • 4 likes
  • 2 in conversation