The file trial05 contains three variables for each subject: Subject ID, treatment group (0 = placebo, 1 = treatment) and disease duration (see above). There is a space between variables.
1 1 2 2 1 1 3 1 2 4 0 3 5 1 3 6 1 2 7 0 3 8 1 3 9 0 1 10 0 2 11 1 1 12 0 2 13 1 2 14 1 1 15 0 1
16 1 3 17 0 1 18 0 3 19 0 3 20 0 2 21 0 1 22 1 3 23 1 3 24 1 2 25 1 3 26 0 3 27 0 3 28 1 2 29 1 2
30 0 2 31 0 1 32 1 1 33 0 2 34 0 1 35 1 1 36 1 3 37 1 1 38 1 3 39 0 2 40 0 3 41 1 3 42 0 3 43 0 1
44 1 2 45 1 1 46 1 2 47 0 3 48 0 2 49 1 3 50 1 3 51 0 1 52 1 2 53 0 1 54 1 3 55 0 3 56 0 3 57 0 2
58 1 2 59 1 2 60 0 1 61 0 1 62 1 1 63 1 3 64 0 1 65 1 2 66 0 2 67 0 1 68 1 1 69 1 2 70 1 2 71 0 2
72 0 2 73 0 1 74 0 3 75 0 3 76 1 2 77 1 2 78 0 2 79 1 3 80 1 3 81 1 1 82 0 2 83 0 1 84 1 3 85 0 1
86 0 3 87 1 3 88 0 2 89 1 1 90 0 1
What is the input statement for this data??
filename t5 '/folders/myfolders/trial03_f18.txt/';
run;
data trial05;
infile t5;
input ????????;
run;
Is it an Excel or .txt file?
it's a .txt
Like this?
data trial05;
infile t5 flowover;
input Subject_ID $ treatment_group disease_duration @@;
run;
it's not working. what i would need is to make it look like this:
ID treatment_group disease_duration
1 1 2
2 1 1
............
Saying "It's not working" provides very little information to work with 🙂 Post your log please.
When I run the code I posted, I get this
this is what I get.. and LOG has no errors
data have;
infile cards flowover dlm=' ';
input ID $ group disease @@;
cards;
1 1 2 2 1 1 3 1 2 4 0 3 5 1 3 6 1 2 7 0 3 8 1 3 9 0 1 10 0 2 11 1 1 12 0 2 13 1 2 14 1 1 15 0 1
16 1 3 17 0 1 18 0 3 19 0 3 20 0 2 21 0 1 22 1 3 23 1 3 24 1 2 25 1 3 26 0 3 27 0 3 28 1 2 29 1 2
30 0 2 31 0 1 32 1 1 33 0 2 34 0 1 35 1 1 36 1 3 37 1 1 38 1 3 39 0 2 40 0 3 41 1 3 42 0 3 43 0 1
44 1 2 45 1 1 46 1 2 47 0 3 48 0 2 49 1 3 50 1 3 51 0 1 52 1 2 53 0 1 54 1 3 55 0 3 56 0 3 57 0 2
58 1 2 59 1 2 60 0 1 61 0 1 62 1 1 63 1 3 64 0 1 65 1 2 66 0 2 67 0 1 68 1 1 69 1 2 70 1 2 71 0 2
72 0 2 73 0 1 74 0 3 75 0 3 76 1 2 77 1 2 78 0 2 79 1 3 80 1 3 81 1 1 82 0 2 83 0 1 84 1 3 85 0 1
86 0 3 87 1 3 88 0 2 89 1 1 90 0 1
;
The SAS System
Obs ID group disease
1 1 1 2
2 2 1 1
3 3 1 2
4 4 0 3
5 5 1 3
6 6 1 2
7 7 0 3
8 8 1 3
9 9 0 1
10 10 0 2
11 11 1 1
12 12 0 2
13 13 1 2
14 14 1 1
15 15 0 1
16 16 1 3
17 17 0 1
18 18 0 3
19 19 0 3
20 20 0 2
21 21 0 1
22 22 1 3
23 23 1 3
24 24 1 2
25 25 1 3
26 26 0 3
27 27 0 3
28 28 1 2
29 29 1 2
30 30 0 2
31 31 0 1
32 32 1 1
33 33 0 2
34 34 0 1
35 35 1 1
36 36 1 3
37 37 1 1
38 38 1 3
39 39 0 2
40 40 0 3
41 41 1 3
42 42 0 3
43 43 0 1
44 44 1 2
45 45 1 1
46 46 1 2
47 47 0 3
48 48 0 2
49 49 1 3
50 50 1 3
51 51 0 1
52 52 1 2
53 53 0 1
54 54 1 3
55 55 0 3
56 56 0 3
57 57 0 2
58 58 1 2
59 59 1 2
60 60 0 1
61 61 0 1
62 62 1 1
63 63 1 3
64 64 0 1
65 65 1 2
66 66 0 2
67 67 0 1
68 68 1 1
69 69 1 2
70 70 1 2
71 71 0 2
72 72 0 2
73 73 0 1
74 74 0 3
75 75 0 3
76 76 1 2
77 77 1 2
78 78 0 2
79 79 1 3
80 80 1 3
81 81 1 1
82 82 0 2
83 83 0 1
84 84 1 3
85 85 0 1
86 86 0 3
87 87 1 3
88 88 0 2
89 89 1 1
90 90 0 1
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.