Statistical Procedures

Programming the statistical procedures from SAS
BookmarkSubscribeRSS Feed
Emma_at_SAS
Lapis Lazuli | Level 10
Hi everyone,
I want to compare the means and proportions between two different samples. The two data sets do not have common individuals or variables. I need to compare some common measures between these two samples.
For example, comparing age in sample 1 vs. sample 2 and %male in sample 1 vs. sample 2.
Instead of merging the two data, I want to create the summary statistics for each sample and use them for my comparison.
Do you know any procedure in SAS that I can use to compare summary statistics?
Thank you!
4 REPLIES 4
mkeintz
PROC Star

You say that



The two data sets do not have common individuals or variables.
If you don't have common variables, then how do you know the mean age, or proportion male in BOTH datasets.  Do you merely mean that the varibles in the datasets have the same information (i.e. age in year, and two values for sex), but those variables don't have the same name (or in the case of sex, the same variable type)?
 
If so, then you could modify one of the datasets to emulate the variable attributes (e.g. varname, vartype) and coding scheme (e.g. "M", "F" instead of 0,1) in the other data set.  Then you're ready to combine the compatible data sets and execute a t-test (age contrast) and a proc freq (for sex distribution comparison).
--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
Norman21
Lapis Lazuli | Level 10

If you don't have (or don't want to use) the raw data, and only have summary data, some coding is required. More here:

 

https://www.lexjansen.com/nesug/nesug06/an/da24.pdf

Norman.
SAS 9.4 (TS1M6) X64_10PRO WIN 10.0.17763 Workstation

PaigeMiller
Diamond | Level 26

Instead of merging the two data

(Perhaps you mean "instead of appending the two data")

 

This is a restriction which makes the programming much harder and ought to be eliminated. You (or your company or university) is paying for all the work already done by SAS to compare means and percents, plus SAS has tested it, fixed bugs and proved that these work in millions of real world applications — don't try to do this yourself.

 

Use the RAW data. Append the two data sets. This makes everything you do much simpler. Compare the means by PROC TTEST or PROC MEANS (or SURVEYMEANS). Compare the percents by using PROC FREQ (or SURVEYFREQ).

--
Paige Miller
Ksharp
Super User

If there are only two group, compare MEAN of two group by PROC TTEST or PROC N1PARM + willconx.

compare PROPORTION(a.k.a risk ratio) of two group by

PROC FREQ ;

TABLE group*gender/relrisk ;

run;

 

@Rick_SAS  wrote bolgs about these before.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1311 views
  • 4 likes
  • 5 in conversation