Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 03-30-2019 05:55 PM
(857 views)

Hi everyone,

I am trying to solve the following question but I am lost as to how to do this. There are two datasets involved but they can be linked by patient id which is present in both datasets. However I am trying to calculate statistics of three variables as described in my code below: Any thoughts or queries. Sorry, I can't post the dataset but I'd appreciate some help.

```
/*8
Using the SAS datasets demogdemo and visitdemo and PROC MEANS with the CLASS statement,
```

compute the mean, median, 25th percentile, 75th percentile, and the number of non-missing

values for the variables CD4, Weight, and Age for each value of civil status
including missing. Report the statistics to three decimal places. In the same PROC MEANS,

create a summary dataset with the OUTPUT statement containing the median and mean of CD4,

Weight, and Age. Using _TYPE_, print only the overall (i.e. all civil
status categories combined) mean and median from this summary dataset.
*/
title "Using a CLASS Statement with PROC MEANS";
proc means data=lb.visitdemo n mean median Q1 Q3 maxdec=3; *what about demogdemo?;
class civilstatus;
var CD4 Weight Age ;
run;

T

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

proc means accepts one dataset as input, so you will have to do the join first.

5 REPLIES 5

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

proc means accepts one dataset as input, so you will have to do the join first.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

How would you join these datasets?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@Flexluthorella wrote:

How would you join these datasets?

With SQL or with a data step merge.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Does it matter if you use proc sql or merge if you want to use the proc means by class statement?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

Upcoming Events

- VALSUG User Group Meeting | 07-Nov-2024
- Ask the Expert: How Do I Perform Customer Segmentation With SAS Intelligent Decisioning? | 12-Nov-2024
- Ask the Expert: How Do I Perform Customer Segmentation With SAS Intelligent Decisioning? | 12-Nov-2024
- Club SAS de Quebec | 13-Nov-2024
- Hands-on Workshop: SAS® Viya® Workbench (at SAS Headquarters) | 13-Nov-2024
- SAS Bowl XLV, SAS Visual Analytics | 13-Nov-2024
- Ask the Expert: Leveraging R for Statistical Analysis in LSAF | 19-Nov-2024

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.