BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
lj653
Fluorite | Level 6

I'm a new user to SAS, and I am trying to figure out how to run a two sample t-test by referencing data I had previously imported from two different excel files. I am using the most recent version of SAS studio (I installed SAS on my Virtual Box two weeks ago). When importing my excel files, I used this code: 

 

PROC IMPORT OUT= WORK.auto
DATAFILE= "/folders/myfolders/auto.xls"
DBMS=XLS REPLACE;
GETNAMES=YES;
RUN;

 

I am aware that you can run two sample t-tests by using this kind of code:

 

DATA response;

   INPUT group $ time;

DATALINES;

c 80

c 93

c 83

c 89

c 98

t 100

t 103

t 104

t 99

t 102

;

PROC UNIVARIATE DATA = response normal plot;

   class group;

   var time;

   histogram time / midpoints = 80 to 120 by 5 normal;

RUN;

 

However, I am running t-tests on data sets with 1000+ entries, and I was wondering, is there any way that I can reference data in a column on the table I pulled in from the first block of code? Like, instead of copying and pasting in the data set from a column, is there some line of code I can use to just reference a certain column from the data? I would really appreciate it if you can post a sample code that would be able to do this. 

 

Also, is there some manual on SAS that would teach me how to run code on t-tests, Z-scores, chi squares, etc?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
rayIII
SAS Employee

Hi. There's a pretty good chance I'm just not following, but maybe this will help: 

 

1. For a t-test of two independent samples, use proc ttest. 

 

https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_ttest_a0000...

 

2. Once you've imported your data, no pasting of data should necessary.  If your IMPORT creates work.auto, then reference that datast on your subsequent proc ttest call, e.g.,:

 

proc import out=auto....;

....

...

run; 

proc ttest data = auto....;

...

....

run; 

 

 

View solution in original post

2 REPLIES 2
rayIII
SAS Employee

Hi. There's a pretty good chance I'm just not following, but maybe this will help: 

 

1. For a t-test of two independent samples, use proc ttest. 

 

https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_ttest_a0000...

 

2. Once you've imported your data, no pasting of data should necessary.  If your IMPORT creates work.auto, then reference that datast on your subsequent proc ttest call, e.g.,:

 

proc import out=auto....;

....

...

run; 

proc ttest data = auto....;

...

....

run; 

 

 

lj653
Fluorite | Level 6

I'll try that out and see if it works!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 2141 views
  • 1 like
  • 2 in conversation