I'm trying to get the sum of the Site_Approved2 and Date_Supplied3 by using the sum function or sum statement on SAS studio but nothing worked with me
please advise me on that.
here is my data
Obs Sites_Contracted site_number1 Site_Approved1 Date_Supplied312345678910111213141516171819202122232425262728293031323334353637
34 | 1000 | . | . |
34 | 1001 | . | . |
34 | 1050 | 1 | . |
34 | 1100 | . | 1 |
34 | 1200 | 1 | 1 |
34 | 1250 | 1 | 1 |
34 | 1252 | . | . |
34 | 1300 | . | . |
34 | 1350 | . | 1 |
34 | 1351 | . | . |
34 | 1400 | . | . |
34 | 1401 | . | . |
34 | 1450 | . | . |
34 | 1451 | 1 | . |
34 | 1452 | . | . |
34 | 1453 | . | . |
34 | 1500 | . | . |
34 | 1600 | 1 | . |
34 | 1601 | 1 | 1 |
34 | 1602 | . | . |
34 | 1700 | . | 1 |
34 | 1750 | . | . |
34 | 5000 | . | . |
34 | 5002 | . | . |
34 | 5003 | . | . |
34 | 5003 | . | . |
34 | 5003 | . | . |
34 | 5003 | . | . |
34 | 5003 | . | . |
34 | 5003 | . | . |
34 | 5003 | . | . |
34 | 5004 | . | . |
34 | 5005 | . | . |
34 | 5006 | . | . |
34 | 5007 | . | . |
34 | 5008 | . | 1 |
34 | 5009 | . | . |
Neither, use a summary procedure such as MEANS, SUMMARY, UNIVARIATE, SQL or PROC TABULATE
See an example here:
https://github.com/statgeek/SAS-Tutorials/blob/master/proc_means_basic.sas
I gonna create a report in another step
but I need to sum those variables to create a histogram
@mona4u wrote:
I gonna create a report in another step
but I need to sum those variables to create a histogram
What makes you think that? Did you try creating a histogram with the raw data? And what does that have to do with my suggestion of using PROC MEANS/SUMMARY?
I would suggest you look at PROC UNIVARIATE and the HISTOGRAM statement within it. There's a lot of examples within the documentation that align with what you're trying to do.
Bc Proc Univariate creates too many things that I don't need to include in my report
I need to create a simple histogram like this after getting the total of each variable to insert it after the table that I created it by proc report
. So, I what I need to know is how to create a histogram from the total of those variable and how to insert it in proc report?
You can control what is included in the output and have no output as well. And PROC MEANS is how you would create that summary anyways.
https://blogs.sas.com/content/iml/2015/05/26/suppress-ods.html
The first example I demonstrated doesn't create any output because it used NOPRINT but did create the summary statistics. Did you try running that code? It' uses the data sets from SASHELP so you can run it directly in your session.
@mona4u wrote:
Bc Proc Univariate creates too many things that I don't need to include in my report
I'm bias about proc report for some reasons and I need to know how possible is create a histogram or chart there
@mona4u wrote:
I'm bias about proc report for some reasons and I need to know how possible is create a histogram or chart there
Proc report doesn't do graphics. Proc report will create output datasets but you still need to send the data to a graphics procedure.
tell me how to do the graph before proc report and how to output the graph along with the table in the proc report.
ods excel file='C:\_localdata\temp.xlsx' style=meadow options(sheet_interval='none');
title 'My Histogram';
proc sgplot data=sashelp.class;
histogram height;
run;
title 'My Proc Report';
proc report data=sashelp.class;
column sex age;
define sex / group;
define age / across;
run;
ods excel close;
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!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.