BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
tobyfarms
Fluorite | Level 6

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;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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

10 REPLIES 10
PaigeMiller
Diamond | Level 26

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
PeterClemmensen
Tourmaline | Level 20

Can't see the picture 🙂

tobyfarms
Fluorite | Level 6
  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

 

tobyfarms
Fluorite | Level 6

SampleDOC1.jpg

tobyfarms
Fluorite | Level 6

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;

PaigeMiller
Diamond | Level 26

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
tobyfarms
Fluorite | Level 6
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;
Reeza
Super User
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;


 

tobyfarms
Fluorite | Level 6
@Reeza hello, I am still receiving the same result using the LIST option.
Reeza
Super User

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;

 

 

 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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