turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- SAS input format for one way ANOVA

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-08-2017 07:31 PM

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

Accepted Solutions

Solution

10-08-2017
07:45 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to YueLSU

10-08-2017 07:39 PM

```
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;
```

All Replies

Solution

10-08-2017
07:45 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to YueLSU

10-08-2017 07:39 PM

```
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;
```

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to WarrenKuhfeld

10-08-2017 07:46 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to YueLSU

10-08-2017 08:17 PM

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