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.

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!

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
  • 885 views
  • 0 likes
  • 2 in conversation