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.

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!

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.

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
  • 1 reply
  • 589 views
  • 0 likes
  • 2 in conversation