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;
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;
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?
Can't see the picture 🙂
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
|
profilecode2=NJAMP
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;
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.
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;
tables nem_hud*kwh /nocol norow nopercent chisq LIST;
Try the LIST option.
@tobyfarms wrote:
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;
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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.