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

I'm trying to produce report as in the picture on the right, but I'm always getting pdf looking as in the first picture (by running the following code).

ods pdf file='D:\SAS_projekt.pdf';

options nodate nonumber;

title1 'Średni kwartalny zysk ze sprzedaży produktów z kategorii mebli';

proc print data=prdsale_polaczone_mean label noobs;

  id country year;

  var quarter actual_mean_meble;

run;

ods pdf close;

I tried using "BY" with variables "country" (label "Kraj") and "year" (label "Rok"), but I need to have all data in one table. Could somebody help me?

a.pngb.png


a.pngb.png
1 ACCEPTED SOLUTION

Accepted Solutions
Alpay
Fluorite | Level 6

You can also get the desired output by using proc report instead of proc print.

Could you replace your proc print statement with the following proc report statement?

(I have tested it using sashelp.prdsale data set.)

Zafer

ods pdf file='D:\SAS_projekt.pdf';

options nodate nonumber;

title1 'Średni kwartalny zysk ze sprzedaży produktów z kategorii mebli';

proc report data=prdsale_polaczone_mean nowd;

  column Country Year quarter actual_mean_meble;

  define Country / group id;

  define Year / group id;

  define quarter / group id;

  define actual_mean_meble / analysis;

run;

ods pdf close;

View solution in original post

2 REPLIES 2
Alpay
Fluorite | Level 6

You can also get the desired output by using proc report instead of proc print.

Could you replace your proc print statement with the following proc report statement?

(I have tested it using sashelp.prdsale data set.)

Zafer

ods pdf file='D:\SAS_projekt.pdf';

options nodate nonumber;

title1 'Średni kwartalny zysk ze sprzedaży produktów z kategorii mebli';

proc report data=prdsale_polaczone_mean nowd;

  column Country Year quarter actual_mean_meble;

  define Country / group id;

  define Year / group id;

  define quarter / group id;

  define actual_mean_meble / analysis;

run;

ods pdf close;

ballardw
Super User

Or

proc tabulate data=prdsale_polaczone_mean;

     class country year quarter;

     var actual_mean_meble;

     table country *year*quarter, actual_mean_meble * sum=''*f=$10.2;

run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 809 views
  • 3 likes
  • 3 in conversation