Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- How do I organize my data?

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-22-2013 03:25 PM

I'm trying to organize my dataset with multiple variables in a table with descriptive statistics. Some of them are responses to demographic questions, some responses to survey questions, and then there are many additional variables that I do not need to analyze. How do I arrange these in a table so that I see only the variables I want to see and not the ones I don't? (ie drop the ones I don't need or select the ones I do need?) I know I use the:

proc freq

tables

procedure-- just not exactly sure how to go from there. Appreciate any help!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-22-2013 07:37 PM

export the variables to Excel and then sort it in the way you like to see in the final output . Delete the variables you don't like to keep. Then run the following code

%let keep_var= <copy and paste the sorted variable names from Excel here or just type in the variable names you like to keep>;

data want;

retain &keep_var.;

set have;

run;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-22-2013 07:54 PM

I don't fully understand your question, can you provide more details.

Are you looking to organize a dataset or your output table?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-22-2013 08:17 PM

Correct Reeza. I assumed that cnspencer asked about organizing the output data.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-23-2013 10:51 AM

Hi Reeza and Mit-- Perhaps my question was misleading-- I'm basically trying to see my data in a table- that summarizes the frequencies and descriptive statistics for only select variables I'm analyzing (some dichotomous, some contininous, and most categorical)- I thought I used:

proc freq;

table (var1) (var2) (var3) (etc..)

Just wondering if there is a better way to do this? So that it will summarize output I want, organized in a way that makes sense for what I'm trying to do (which is describe my population so that I can then look at whether or not those charateristics predict certain outcomes..)

Thanks a lot!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-23-2013 10:55 AM

Not really. Generally I'll just run a whole bunch of procs (freq/means) on my variables to first get an idea.

Once I'm more familiar with my data then I follow the standards in this paper for preparing results, primarily for publication. SAS doesn't do this by default, so it takes a bit of manipulation by the coder/user to generate such tables.

A guide for preparing a patient-oriented research manuscript

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-23-2013 12:05 PM

Thanks Reeza. Yeah I'm pretty skilled/educated on analyzing the output-- it's just getting my data to give me that output (ie knowing the SAS language since I was required to use STATA in school )

Do you just dump all variables in following the table statement? Is it ok to place variables of mixed types (cont/cat/dichot) following the table statement? Also-- do you know a command for merging 2 data sets together so that I can look at everything in one big table?

Thanks!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-23-2013 12:09 PM

Check out the UCLA tutorials:

http://www.ats.ucla.edu/stat/sas/

It's fine to dump all the categorical data into a proc freq but useless for continuous variables.

For continuous variables use proc univariate instead.