Help using Base SAS procedures

A regression problem...

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 9
Accepted Solution

A regression problem...

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\Time38.541.544.547.550.553.556.5
11002110100

1300

1112000
15001121210
17000213220
19000134211
21000125421
23000124562
25000232486

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


Accepted Solutions
Solution
‎09-07-2012 01:01 PM
Trusted Advisor
Posts: 2,113

Re: A regression problem...

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;

View solution in original post


All Replies
Trusted Advisor
Posts: 1,631

Re: A regression problem...

If you look at the SASLOG, you will find that your data set WORKERS never gets created because of errors in your code there.

Occasional Contributor
Posts: 9

Re: A regression problem...

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?

Trusted Advisor
Posts: 1,631

Re: A regression problem...

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.

Solution
‎09-07-2012 01:01 PM
Trusted Advisor
Posts: 2,113

Re: A regression problem...

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;

Occasional Contributor
Posts: 9

Re: A regression problem...

I'm so sorry for that, I'm newbie here.

Thank you for the answere

Trusted Advisor
Posts: 2,113

Re: A regression problem...

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

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 190 views
  • 2 likes
  • 3 in conversation