BookmarkSubscribeRSS Feed
jbbush42
Fluorite | Level 6

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.

7 REPLIES 7
Reeza
Super User

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;
jbbush42
Fluorite | Level 6

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

jbbush42
Fluorite | Level 6
How did you come up with the @32 @ 41 @21? where do those numbers come from and to what do the correspond?
Reeza
Super User

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?

 

jbbush42
Fluorite | Level 6

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.

jbbush42
Fluorite | Level 6
I've figured it out. i removed the "print" and replaced with "lp"
jbbush42
Fluorite | Level 6

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

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 7 replies
  • 958 views
  • 2 likes
  • 2 in conversation