BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
EhsanKhedive
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
Doc_Duke
Rhodochrosite | Level 12

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

6 REPLIES 6
PaigeMiller
Diamond | Level 26

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

--
Paige Miller
EhsanKhedive
Calcite | Level 5

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?

PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
Doc_Duke
Rhodochrosite | Level 12

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;

EhsanKhedive
Calcite | Level 5

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

Thank you for the answere

Doc_Duke
Rhodochrosite | Level 12

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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