BookmarkSubscribeRSS Feed
avinesh
Fluorite | Level 6

Need a help to get output like my sample output..can anyone help me out..thanks in advance


Sample output.png
1 REPLY 1
Amir
PROC Star

Hi,

I made some assumptions in coming up with the following:

data have;

  infile datalines dlm=',';

  input dt date9. amount;

  datalines;

30APR2013,100

31MAY2013,200

30JUN2013,300

31JUL2013,100

31AUG2013,200

30SEP2013,300

31OCT2013,100

30NOV2013,200

31DEC2013,300

31JAN2014,100

28FEB2014,200

31MAR2014,300

;

data want;

  file 'your-file-path' dlm=',';

  set have end=lastrec;

  put dt monname9. amount;

  subtotal+amount;

  grandtotal+amount;

  monthcount+1;

  if mod(monthcount,3)=0 then

  do;

    quarter=cat("QTR ",ifn(qtr(dt)=1,4,qtr(dt)-1));

    put quarter subtotal;

    if lastrec then

      months="Grandtotal";

    else

      months=cat(monthcount," months");

    put months grandtotal;

    subtotal=0;

  end;

run;

If you need something else then please supply more information, such as input data.

Regards,

Amir.

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!
Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 932 views
  • 0 likes
  • 2 in conversation