DATA Step, Macro, Functions and more

Farm plan

Reply
Occasional Contributor
Posts: 11

Farm plan

Im not sure why the program isnt using all my land (acres) and I'm not sure why my labor is being misinterpreted. Not very experienced using this program but its for a school project.

Attachment
Super User
Posts: 24,003

Re: Farm plan

Your log is full of errors so that's usually the place to start.

 

This reads your data correctly. Please post your code directly into the forum in the future.

 

data tobfarm;
infile datalines truncover;
input @1 _id_  $20.  @21 Soybeans  @32  _type_ $ @41 _rhs_;
datalines;
Profit              190        max      
Land                1          le		275
January Labor       0          le		200
Febraury Labor      0   	   le 		200
March Labor         0          le 		200
April Labor         .25    	   le		200
May Labor     		.25		   le 		200
June Labor     		.25		   le		200
July Labor    		0   	   le 		200
August Labor     	0		   le 		200
September Labor     1.5        le		200
October Labor       1.5        le		200
November Labor      .25        le		200
December Labor      0          le		200
Capital             300        le		14000
;

proc print;run;
Occasional Contributor
Posts: 11

Re: Farm plan

Thanks. I don't know what I'm doing or why certain things work for what reasons. I may be back sometime tonight with more questions

Occasional Contributor
Posts: 11

Re: Farm plan

How did you come up with the @32 @ 41 @21? where do those numbers come from and to what do the correspond?
Super User
Posts: 24,003

Re: Farm plan

Column numbers. Your data is aligned with the starting location the same for all the data, so the start of each column is where you tell SAS to start reading the data. 

 

Usually you can use a delimiter, but since your first term has spaces, how does SAS know that two words should go together? So that method cannot be used. 

 

This is not the only way to read this file, just one that works. 

 


@jbbush42 wrote:
How did you come up with the @32 @ 41 @21? where do those numbers come from and to what do the correspond?

 

Occasional Contributor
Posts: 11

Re: Farm plan

I'm now worse than i started. I need to have more results than the one box result that this data set produces. I need to have the multiple boxes that show different things. Im sorry i have no idea what they're called.

Occasional Contributor
Posts: 11

Re: Farm plan

I've figured it out. i removed the "print" and replaced with "lp"
Occasional Contributor
Posts: 11

Re: Farm plan

How's this gem? 

 


data tobfarm;
infile datalines truncover;
input @1 _id_ $20. WheatSoyDoubleCrop CowCalf Corn @21 Soybeans @32 _type_ $ @41 _rhs_;
datalines;
Profit 70 89.52 59.61 190 max
Pasture 0 2.5 0 0 le 320
Land 1 0 1 1 le 275
January Labor 0 85 0 0 le 200
Febraury Labor 0 85 0 0 le 200
March Labor 0 85 0 0 le 200
April Labor 1 85 .25 .25 le 200
May Labor 1 85 .25 .25 le 200
June Labor 1 85 .25 .25 le 200
July Labor 0 85 0 0 le 200
August Labor 0 85 0 0 le 200
September Labor .25 85 1.75 1.5 le 200
October Labor 1.75 85 1.75 1.5 le 200
November Labor 1.5 85 .75 .25 le 200
December Labor 0 85 0 0 le 200
Capital 630 1035 762 300 le 140000
;

proc lp;run;

 

 

 

 

I've got 4 production possibilities: 1.WheatSoyDoubleCrop

                                                      2.CowCalf

                                                      3.Corn

                                                      4.Soybeans

 

I'm not sure i've arranged the data correctly for the CowCalf possibilities. I had to add another variable (pasture) which is not supposed to be considered by the other 3 production possibilities. Thanks

Ask a Question
Discussion stats
  • 7 replies
  • 169 views
  • 2 likes
  • 2 in conversation