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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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