Hi, I have some problems with entering a data table for analyzing with, for example, proc reg.
I want to enter a 7*8 table of 100 worker's wok time and wages as data, and find the regression model for it.
Wage\Time | 38.5 | 41.5 | 44.5 | 47.5 | 50.5 | 53.5 | 56.5 |
---|---|---|---|---|---|---|---|
1100 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
1300 | 1 | 1 | 1 | 2 | 0 | 0 | 0 |
1500 | 1 | 1 | 2 | 1 | 2 | 1 | 0 |
1700 | 0 | 2 | 1 | 3 | 2 | 2 | 0 |
1900 | 0 | 1 | 3 | 4 | 2 | 1 | 1 |
2100 | 0 | 1 | 2 | 5 | 4 | 2 | 1 |
2300 | 0 | 1 | 2 | 4 | 5 | 6 | 2 |
2500 | 0 | 2 | 3 | 2 | 4 | 8 | 6 |
I've tried do statement in this way:
Data Workers;
do pay= 1100 1300 1500 1700 1900 2100 2300 2500;
time= 38.5 41.5 44.5 47.5 50.5 53.5 56.5;
input rep @@;
output;
end;
end;
cards;
2 1 1 0 1 0 0
1 1 1 2 0 0 0
1 1 2 1 2 1 0
0 2 1 3 2 2 0
0 1 3 4 2 1 1
0 1 2 5 4 2 1
0 1 2 4 5 6 2
0 2 3 2 4 8 6
;
proc reg;
model pay=time;
plot pay*time;
run;
but it didn't work.
how can i run a regression with this type of data??
Thank you
eshan,
Try this.
Doc
Data Workers;
do pay= 1100, 1300, 1500, 1700, 1900, 2100, 2300, 2500;
do time= 38.5, 41.5, 44.5, 47.5, 50.5, 53.5, 56.5;
input rep @@;
output;
end;
end;
cards;
2 1 1 0 1 0 0
1 1 1 2 0 0 0
1 1 2 1 2 1 0
0 2 1 3 2 2 0
0 1 3 4 2 1 1
0 1 2 5 4 2 1
0 1 2 4 5 6 2
0 2 3 2 4 8 6
;
proc reg;
model pay=time;
freq rep;
run;
If you look at the SASLOG, you will find that your data set WORKERS never gets created because of errors in your code there.
Yes, I know, but i don't know how to enter this type of data to SAS. I know i can create a two column x*y entry, but for 100 entry it's a little time consuming. can you help me with this?
A side comment ... if you knew the problem was reading the data, and you posted a topic/subject line that indicated you were having a problem reading certain type of data, you would get more of the right type of people reading this thread. As it is, your subject line attracts people who are statistical experts, but not experts at reading data problems.
So, my suggestion is that you start a new thread with an appropriate subject/topic about how you are having trouble reading a certain type of data.
eshan,
Try this.
Doc
Data Workers;
do pay= 1100, 1300, 1500, 1700, 1900, 2100, 2300, 2500;
do time= 38.5, 41.5, 44.5, 47.5, 50.5, 53.5, 56.5;
input rep @@;
output;
end;
end;
cards;
2 1 1 0 1 0 0
1 1 1 2 0 0 0
1 1 2 1 2 1 0
0 2 1 3 2 2 0
0 1 3 4 2 1 1
0 1 2 5 4 2 1
0 1 2 4 5 6 2
0 2 3 2 4 8 6
;
proc reg;
model pay=time;
freq rep;
run;
I'm so sorry for that, I'm newbie here.
Thank you for the answere
We were all newbie's once. For me, that was a very long time ago....
You had a mix of data programming and the procedure statements that were causing headaches. That sort of DATA step can be very efficient, but has challenges. I saw the missing DO immediately, but had forgotten the need for commas until I saw the next round of errors. Then, there was FREQ (vs WEIGHT) for count data. I dropped the PLOT statement because SAS 9.3 provides very nice statistical graphics by default.
Doc Muhlbaier
Duke
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.