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

When using optmodel and using read data can i do calculation. like i want to take 10% of the value "FEU" and store in this number GIC_Min. Not sure if i can do that. I did that and got error. 

 

num GIC_Min;

READ DATA STDOPT.PN3158_specifics INTO GIC_Min=0.1*[FEU];

1 ACCEPTED SOLUTION

Accepted Solutions
RobPratt
SAS Super FREQ

No, you cannot do that.  You need an explicit assignment statement after the READ DATA statement, as demonstrated in these two documentation examples:

With CREATE DATA, you can perform calculations if you use parentheses around the expression, as shown in the documentation here.

View solution in original post

7 REPLIES 7
RobPratt
SAS Super FREQ

No, you cannot do that.  You need an explicit assignment statement after the READ DATA statement, as demonstrated in these two documentation examples:

With CREATE DATA, you can perform calculations if you use parentheses around the expression, as shown in the documentation here.

Santha
Pyrite | Level 9

Thanks Rob I will go through those two examples. 

I have 4 or 5 questions those are very specific to a constraint. Can i post those as a separate thread (one for each)? 

RobPratt
SAS Super FREQ

Yes, please use separate threads for different questions.

Santha
Pyrite | Level 9

THe assignment statement in your example did the trick. Awesome Rob! Thank you very much

Santha
Pyrite | Level 9

READ DATA STDOPT.PN3158_ALT6_SPECIFICS INTO LAX_Min=FEU

In this read data statement in proc optmodel, I want to read only when the column name in my table "Dest" = "LAX".

How do I specify the condition?

 

RobPratt
SAS Super FREQ

You can use DATA step options in the READ DATA statement, as documented here.

 

For your example, it would like this:

READ DATA STDOPT.PN3158_ALT6_SPECIFICS(where=(Dest = "LAX")) INTO LAX_Min=FEU;
Santha
Pyrite | Level 9

Awesome. Thanks a lot Rob

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 820 views
  • 0 likes
  • 2 in conversation