Hi there my SAS friends:
One more time here, it's me (LOL). Needing some important help.
Let me show you what exactly i am looking for many years ago, really, YEARS, but, here i go!
ill show you the examplethat i1m trying to solve:
data Transpose1;
input Tratamento$ repet Field_1 Field_2 Field_3 Field_4 Field_5;
cards;
A_ai 1 4 2 2 3 3
A_ai 2 3 2 2 4 2
A_ai 3 1 1 1 1 1
A_ai 4 1 2 1 1 2
A_ai 5 2 5 4 2 6
A_ai 6 1 1 1 1 1
A_ai 7 3 2 2 3 1
A_ai 8 2 2 3 4 3
A_ai 9 2 1 1 1 2
A_ai 10 1 2 1 1 1
;
PROC TRANSPOSE data=Transpose1 out=Transpose2 (drop=_:);
by Tratamento;
var Field_1 Field_2 Field_3 Field_4 Field_5;
run;
proc print data=Transpose1;
run;
proc print data=Transpose2;
run;
so, there is all good, here is the problem, work with 10 lines of data is simple, cause in MS EXCEL, i can manage manually these 60 data, (it takes time for real), so i was wondering if you could help me to get this answer without tabulate manually in MS excel or some similar software:
data Example;
input Tratamento$ repet Field Result;
cards;
A_ai 1 1 4
A_ai 1 2 2
A_ai 1 3 2
A_ai 1 4 3
A_ai 1 5 3
A_ai 2 1 3
A_ai 2 2 2
A_ai 2 3 2
A_ai 2 4 4
A_ai 2 5 2
A_ai 3 1 1
A_ai 3 2 1
A_ai 3 3 1
A_ai 3 4 1
A_ai 3 5 1
A_ai 4 1 1
A_ai 4 2 2
A_ai 4 3 1
A_ai 4 4 1
A_ai 4 5 2
A_ai 5 1 2
A_ai 5 2 5
A_ai 5 3 4
A_ai 5 4 2
A_ai 5 5 6
A_ai 6 1 1
A_ai 6 2 1
A_ai 6 3 1
A_ai 6 4 1
A_ai 6 5 1
A_ai 7 1 3
A_ai 7 2 2
A_ai 7 3 2
A_ai 7 4 3
A_ai 7 5 1
A_ai 8 1 2
A_ai 8 2 2
A_ai 8 3 3
A_ai 8 4 4
A_ai 8 5 3
A_ai 9 1 2
A_ai 9 2 1
A_ai 9 3 1
A_ai 9 4 1
A_ai 9 5 2
A_ai 10 1 1
A_ai 10 2 2
A_ai 10 3 1
A_ai 10 4 1
A_ai 10 5 1
;
proc print data=Example;
run;
So, the examples can be made by hand into excel or similar softwares, but it takes a lot of time.
Appreciate from the bottom of my heart your help.
Jonatan
If I understand correctly you may be looking for something like:
data want (keep = Tratamento$ repet Field Result );
set transpose1;
array f field1-field5;
do field = 1 to dim(f);
result = f[field];
output;
end;
run;
Thanks you very much and Excelent:
im obtaining this:
1 | A_ai | 1 | 1 | . |
---|---|---|---|---|
2 | A_ai | 1 | 2 | . |
3 | A_ai | 1 | 3 | . |
4 | A_ai | 1 | 4 | . |
5 | A_ai | 1 | 5 | . |
6 | A_ai | 2 | 1 | . |
7 | A_ai | 2 | 2 | . |
8 | A_ai | 2 | 3 | . |
9 | A_ai | 2 | 4 | . |
10 | A_ai | 2 | 5 | . |
11 | A_ai | 3 | 1 | . |
12 | A_ai | 3 | 2 | . |
13 | A_ai | 3 | 3 | . |
14 | A_ai | 3 | 4 | . |
15 | A_ai | 3 | 5 | . |
16 | A_ai | 4 | 1 | . |
17 | A_ai | 4 | 2 | . |
18 | A_ai | 4 | 3 | . |
19 | A_ai | 4 | 4 | . |
20 | A_ai | 4 | 5 | . |
21 | A_ai | 5 | 1 | . |
22 | A_ai | 5 | 2 | . |
23 | A_ai | 5 | 3 | . |
24 | A_ai | 5 | 4 | . |
25 | A_ai | 5 | 5 | . |
26 | A_ai | 6 | 1 | . |
27 | A_ai | 6 | 2 | . |
28 | A_ai | 6 | 3 | . |
29 | A_ai | 6 | 4 | . |
30 | A_ai | 6 | 5 | . |
31 | A_ai | 7 | 1 | . |
32 | A_ai | 7 | 2 | . |
33 | A_ai | 7 | 3 | . |
34 | A_ai | 7 | 4 | . |
35 | A_ai | 7 | 5 | . |
36 | A_ai | 8 | 1 | . |
37 | A_ai | 8 | 2 | . |
38 | A_ai | 8 | 3 | . |
39 | A_ai | 8 | 4 | . |
40 | A_ai | 8 | 5 | . |
41 | A_ai | 9 | 1 | . |
42 | A_ai | 9 | 2 | . |
43 | A_ai | 9 | 3 | . |
44 | A_ai | 9 | 4 | . |
45 | A_ai | 9 | 5 | . |
46 | A_ai | 10 | 1 | . |
47 | A_ai | 10 | 2 | . |
48 | A_ai | 10 | 3 | . |
49 | A_ai | 10 | 4 | . |
50 | A_ai | 10 | 5 | . |
just points
Thanks one more time
I found the erro:
Here
array f field1-field5;
and would be
array f field_1-field_5;
Thanks man, you saved my time
May the force be with you!!
If you would mark the question as answered that will help the whole community.
I think this is what you are looking for:
data have;
input Tratamento$ repet Field Result;
cards;
A_ai 1 1 4
A_ai 1 2 2
A_ai 1 3 2
A_ai 1 4 3
A_ai 1 5 3
A_ai 2 1 3
A_ai 2 2 2
A_ai 2 3 2
A_ai 2 4 4
A_ai 2 5 2
A_ai 3 1 1
A_ai 3 2 1
A_ai 3 3 1
A_ai 3 4 1
A_ai 3 5 1
A_ai 4 1 1
A_ai 4 2 2
A_ai 4 3 1
A_ai 4 4 1
A_ai 4 5 2
A_ai 5 1 2
A_ai 5 2 5
A_ai 5 3 4
A_ai 5 4 2
A_ai 5 5 6
A_ai 6 1 1
A_ai 6 2 1
A_ai 6 3 1
A_ai 6 4 1
A_ai 6 5 1
A_ai 7 1 3
A_ai 7 2 2
A_ai 7 3 2
A_ai 7 4 3
A_ai 7 5 1
A_ai 8 1 2
A_ai 8 2 2
A_ai 8 3 3
A_ai 8 4 4
A_ai 8 5 3
A_ai 9 1 2
A_ai 9 2 1
A_ai 9 3 1
A_ai 9 4 1
A_ai 9 5 2
A_ai 10 1 1
A_ai 10 2 2
A_ai 10 3 1
A_ai 10 4 1
A_ai 10 5 1
;
run;
proc transpose data=have out=want(drop=_name_) prefix=field_ ;by Tratamento repet;var field;
Thanks but it is what i did manually to explain the example.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.