BookmarkSubscribeRSS Feed
nishSAS
Calcite | Level 5

Hello Sir/Madam,

 

My data set having three variable two variables are numeric and third is date variable which is in MONYY. format.

I wanted to write a code for

Proc freq data = ;
format Date MONYY.;
tables (NUM QTY) * Date/NOCUM NOFREQ nocol norow;
run;

 

When i am running this code output is generating but that output is giving me frequency and i wanted actual volume for each NUM variable against Date.

 

 

Could you please correct my code or any additional step i wanted to add in it.

 

THanks,

Nishant

5 REPLIES 5
andreas_lds
Jade | Level 19

What do you mean by "i wanted actual volume"? Can you post test data and the output required?

ChrisNZ
Tourmaline | Level 20

You probably want proc tabulate, something like this:

 

proc tabulate ;
  format DATE monyy.;
  class NUM QTY DATE;
  table DATE, (NUM QTY)*n=' ';
run;
ChrisNZ
Tourmaline | Level 20

Maybe yo mean sum when you say volume?

 

Try this:

 

proc tabulate ;
  format DATE monyy.;
  class NUM QTY DATE;
  table DATE, (NUM QTY)*sum=' ';
run;   

 

nishSAS
Calcite | Level 5

Thanks ChrisNZ,

 

But I have used proc Report and i got what i was expecting. Below is the syntax for review

 

proc report data = tab;
column NDC Date, QTY;
define NDC / display Group;
define Date / order order=internal;
define QTY / sum;
define Date / across;

run;

 

Thanks again. Looking forward for more assistance in future 🙂

ballardw
Super User

@nishSAS wrote:

Hello Sir/Madam,

 

My data set having three variable two variables are numeric and third is date variable which is in MONYY. format.

I wanted to write a code for

Proc freq data = ;
format Date MONYY.;
tables (NUM QTY) * Date/NOCUM NOFREQ nocol norow;
run;

 

When i am running this code output is generating but that output is giving me frequency and i wanted actual volume for each NUM variable against Date.

 

 

Could you please correct my code or any additional step i wanted to add in it.

 

THanks,

Nishant


The code you posted will create percent values, not frequencies.

You need to describe what you think you mean by "volumne" as Proc Freq will generate counts, percentages, cumulative counts and percentages (which you have turned off)  row and column percentages(also turned off) and a number of statistical tests (not requested). But "Volumn" needs clarification.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 5 replies
  • 1782 views
  • 0 likes
  • 4 in conversation