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.

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