DATA Step, Macro, Functions and more

Proc Freq distribution issue

Accepted Solution Solved
Reply
Contributor
Posts: 56
Accepted Solution

Proc Freq distribution issue

SampleDOC.jpg

Hello, I am trying to create a proc freq that would produce the KWH (a numeric value) where the frequency counts are.  Instead my KWH values are listed above as if they are headers. 

 

 

ods graphics on;

proc freq data= work.sample_summary2;

tables nem_hud*kwh /nocol norow nopercent chisq;

output out=table1;

by profilecode2;

run;

ods graphics off;

 

 


Accepted Solutions
Solution
‎04-18-2018 12:11 PM
Super User
Posts: 24,003

Re: Proc Freq distribution issue

[ Edited ]
Posted in reply to tobyfarms

PROC FREQ only generates counts. If you want SUMs you need to use PROC MEANS instead.

 

Otherwise I think you need to show what you expect - as of now we're guessing.

 

Also, read your log. Your code as posted generates errors, so it has issues beyond what you're stating here.

 

proc freq data= work.sample_summary2;
tables nem_hud*sum(kwh)  /nocol norow nopercent chisq; <- no sum available here;
output out=table1;
by profilecode2;
run;

 

 

 

 

View solution in original post


All Replies
Respected Advisor
Posts: 3,270

Re: Proc Freq distribution issue

Posted in reply to tobyfarms

Your picture is just too small to be of any use in understanding what you want.

 

Can you fix that? Can you type in a (portion of) the table the way you would like it to be?

--
Paige Miller
PROC Star
Posts: 1,400

Re: Proc Freq distribution issue

Posted in reply to tobyfarms

Can't see the picture Smiley Happy

Contributor
Posts: 56

Re: Proc Freq distribution issue

  Table of NEM_HUD by KWH  KWH(KWH) Total438 938 6278 7000 7559 8269 5452066 9549687 12876498 15214957NEM_HUD  NEM FrequencyNon_NEM Frequency   Total Frequency
11111100006
00011011116
111221111112

 

Contributor
Posts: 56

Re: Proc Freq distribution issue

Posted in reply to tobyfarms

SampleDOC1.jpg

Contributor
Posts: 56

Re: Proc Freq distribution issue

Posted in reply to tobyfarms

SampleDOC2.jpgSampleDOC1.jpg

ods graphics on;

proc freq data= work.sample_summary2;

tables nem_hud*kwh /nocol norow nopercent chisq;

output out=table1;

by profilecode2;

run;

ods graphics off;

Respected Advisor
Posts: 3,270

Re: Proc Freq distribution issue

Posted in reply to tobyfarms

Now we can see the picture. Can you please type in an example of what you want the output to look like? Use the {i} box, or the running man icon when you do this.

--
Paige Miller
Contributor
Posts: 56

Re: Proc Freq distribution issue

Posted in reply to PaigeMiller
I'm looking to summarize the variable "kwh" in the tables statement.  in the results I would like to see the kwh values where the counts are.


proc freq data= work.sample_summary2;
tables nem_hud*sum(kwh)  /nocol norow nopercent chisq;
output out=table1;
by profilecode2;
run;
Super User
Posts: 24,003

Re: Proc Freq distribution issue

Posted in reply to tobyfarms
tables nem_hud*kwh /nocol norow nopercent chisq LIST;

Try the LIST option.

 


@tobyfarms wrote:

SampleDOC2.jpgSampleDOC1.jpg

ods graphics on;

proc freq data= work.sample_summary2;

tables nem_hud*kwh /nocol norow nopercent chisq;

output out=table1;

by profilecode2;

run;

ods graphics off;


 

Contributor
Posts: 56

Re: Proc Freq distribution issue

@Reeza hello, I am still receiving the same result using the LIST option.
Solution
‎04-18-2018 12:11 PM
Super User
Posts: 24,003

Re: Proc Freq distribution issue

[ Edited ]
Posted in reply to tobyfarms

PROC FREQ only generates counts. If you want SUMs you need to use PROC MEANS instead.

 

Otherwise I think you need to show what you expect - as of now we're guessing.

 

Also, read your log. Your code as posted generates errors, so it has issues beyond what you're stating here.

 

proc freq data= work.sample_summary2;
tables nem_hud*sum(kwh)  /nocol norow nopercent chisq; <- no sum available here;
output out=table1;
by profilecode2;
run;

 

 

 

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 10 replies
  • 125 views
  • 0 likes
  • 4 in conversation