BookmarkSubscribeRSS Feed
ksmielitz
Quartz | Level 8

I have run preliminary procedures and have determined that my data is nonparametric...I need to measure the difference in answers between a post-test and a pre-test. For normal data, I would, of course, run a paired t-test, but that won't help me in this case.

Everything that I have found is way above my head--I have only been using SAS for a couple of months now and it's all been for normal data...and, for the most part, as directed by my instructor.

I have two variables posttestanswer and pretestanswer.

Everything I can find talks about defining a data set, but my data set is already input into SAS and saved.

I've tried

answerdiff=posttestanswer - pretestanswer;

and that doesn't work...in part because apparently I'm not appropriately defining "answerdiff" but I'm not sure how to do that in this case. And, once I get the silly part defined, then I need help with the proc statement...best I can tell I'd use a proc univariate with the newly identified "answerdiff" for my variable.

Thank you in advance for any help you can provide. Eventually I'll get this... Smiley Happy

Kate


7 REPLIES 7
Reeza
Super User

So assuming you have a dataset with two variables you could do the following:

data step1;

set HAVE;

answerdiff=posttestanswer - pretestanswer;

run;

You could then use PROC UNIVARIATE on the step1 dataset.

proc univariate data=step1;

var step1;

run;

You can also look at PROC NPAR1WAY tests:

proc npar1way data=step1 wilcoxon;

var answerdiff;

run;

ksmielitz
Quartz | Level 8

Reeza,

Thank you for responding!

I get into SAS now and give it a shot!

Kate

ksmielitz
Quartz | Level 8

Reeza,

Apologizing in advance for my blatant ineptitude...

I tried what you suggested and keep getting these errors:

25   data step1;

26   set HAVE; (I have also substituted in the name of my data and my set and tried it every which way I can think of.)

ERROR: File WORK.HAVE.DATA does not exist.... or

ERROR: Libref ATC_DATA is not assigned or

ERROR: File WORK.ATC_DATA.DATA does not exist

27 answerdiff=postidstolen - preidstolen;

28   run;

So, with that said...if you don't mind holding my hand a little more...

I've done my proc import. Data file is in and set to run.

data ATC_data;

set ATC_data.fcs;

I then have identified my variables:

*preidstolen;

if preidstolen in (1:5) then do;

SD=preidstolen=1;

and so on through

SA=preidstolen=5;

end;

*postidstolen;

if postidstolen in (1:5) then do;

see preidstolen for breakdown.

So, now I want to define "stolendiff" (stolendiff=postidstolen-preidstolen) but I can't figure out how to get it to work

Ksharp
Super User

I think Both of your method are right .  If there are some other variables ,I would consider Covariance Analysis by proc glm .

ksmielitz
Quartz | Level 8

I'm going to keep plugging along at it.

There are some other variables...I am back in the stats game after 10 years off (and the sad thing is I really stunk it up then, so the fact that I am understanding now is a delight), though figuring out when to use some of these things is another challenge, LOL. If I need the covariance analysis...which I just might...I'll give it a shot. Thank you!

Reeza
Super User

Run a proc contents on your data set:

proc contents data=atc_data.fcs;

run;

Then post your full code that's generating errors - your code appears correct.

FYI: There is a free intro to SAS course and intro to SAS/STATS course from SAS institute available on SAS Analytics U home page. 

ksmielitz
Quartz | Level 8

I will try that.

I found a possible way to do it in some archived videos my professor posted...but I anticipated different results so I am wondering if the data I am running this procedure on is the wrong type of data...I'll get that one figured out too.

Thanks for the tutorial information. I will definitely check it out!!

Kate

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
  • 854 views
  • 3 likes
  • 3 in conversation