BookmarkSubscribeRSS Feed
cnspencer
Calcite | Level 5

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!

7 REPLIES 7
Mit
Calcite | Level 5 Mit
Calcite | Level 5

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;

Reeza
Super User

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

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

Mit
Calcite | Level 5 Mit
Calcite | Level 5

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

cnspencer
Calcite | Level 5

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!

Reeza
Super User

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

cnspencer
Calcite | Level 5

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 Smiley Sad)

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!

Reeza
Super User

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1997 views
  • 0 likes
  • 3 in conversation