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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1324 views
  • 3 likes
  • 3 in conversation