proc format; value income_format low -< 0 = "low" 1 -< 30 = "low-medium" 30 -< 60 = "average" 60 -< 90 = "high" 90 - high = "excellent"; run; proc freq data = lib1.all; format income income_format.; /* assign IncomeFmt format to Income variable */ tables income /OUT = income_table outcum ; run;
The above code creates custom bins for certain level of incomes, I think create a table to put my data into the custom bins. This all works fine, however I wan't to be able to create the above frequency table by date, my data is monthly and I have a field called DATE. How do I achieve this? Thanks
Found the solution thanks.
proc freq data = lib1.all; format income income_format. DATE YYMMD7.;
by DATE; tables income /OUT = income outcum ; run;
Your answer was just missing specifying to use the `by` line.
Use any one of the date formats that only displays the year and month. Like YYMMD.
https://documentation.sas.com/doc/en/vdmmlcdc/8.1/ds2pg/p0bz5detpfj01qn1kz2in7xymkdl.htm
@sasprogramming wrote:
this doesn't answer my question??
Try it, i.e. use YYMMD7. as the format in proc freq.
I think you'll see that it does answer your question.
Unless, of course, we have a Maxim 42 issue here 😉
Found the solution thanks.
proc freq data = lib1.all; format income income_format. DATE YYMMD7.;
by DATE; tables income /OUT = income outcum ; run;
Your answer was just missing specifying to use the `by` line.
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.
Ready to level-up your skills? Choose your own adventure.