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

Hi folks this is my first post in this community and it would be really appreciated if someone give some advise.

 

I am editing code for a one-way anova analysis but how I in put data before was all like this, for wxample:

 

Input Name $ value;

cards;

a 1

a 2

a 3

b 4

b 5 

b 6

c 7

c 8

c 9;

 

However this time I got a large data set organized like this:

 

a 1 2 3

b 4 5 6

c 7 8 9

 

I am wondering how I can input to assign all values in the same row following 'a' to variable 'Name', and same for 'b', and 'c', without having to return to next row each time?

 

Thanks so much

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenKuhfeld
Rhodochrosite | Level 12
data x(drop=i);
input Name $ @;
do i = 1 to 3; input value @; output; end;
datalines;
a 1 2 3
b 4 5 6
c 7 8 9
;
proc print; run;

View solution in original post

3 REPLIES 3
WarrenKuhfeld
Rhodochrosite | Level 12
data x(drop=i);
input Name $ @;
do i = 1 to 3; input value @; output; end;
datalines;
a 1 2 3
b 4 5 6
c 7 8 9
;
proc print; run;
YueLSU
Calcite | Level 5

Thanks so much Warren! I spent the whole day could not make it. Thanks for the timely reply. It helped a lot

WarrenKuhfeld
Rhodochrosite | Level 12

http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_glm_examples...

 

Glad I could help!  That method of reading data for modeling is in the documentation here and probably other places as well.

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!

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