DATA Step, Macro, Functions and more

CARDS statement format

Reply
Contributor
Posts: 23

CARDS statement format

Hello I want to read in a small dataset and just want to make sure my format is correct. I have 4 groups and 5 observations per group. 

I have a feeling  its wrong because when i run a chi square test i'm getting " . " as some of the calculated values

 

DATA q3; 
INPUT drug $ response ;
CARDS ;
a 42 17 24 39 43 
b 28 50 44 32 61
c 57 45 48 41 54
d 29 40 22 34 30
;
run;
Super User
Posts: 23,224

Re: CARDS statement format

Posted in reply to iressa131

Your input statement should have enough variables to match your data but you only list two. Do you want the data to look as shown or do you want it reformatted to a long format like:

 

a 42

a 17

a 24

 

 

If you want the wide format, add the rest of the variables to your list, reponse1-response5. 

If you want the long format you need to use a trailing @@ to hold the line when reading the data.

Ask a Question
Discussion stats
  • 1 reply
  • 99 views
  • 0 likes
  • 2 in conversation