BookmarkSubscribeRSS Feed
iressa131
Calcite | Level 5

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;
1 REPLY 1
Reeza
Super User

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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 888 views
  • 0 likes
  • 2 in conversation