BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I use PROC LP with sparsedata input. Is there a known problem with sparsedata with THREE pairs of (row, coeff) in one data row
or did I miss something?

The input data looks as follows:

data GASOPT;
Format _TYPE_ $8. _COL_ $25. _ROW1_ $28. _COEF1_ comma12. _ROW2_ $7. _COEF2_ comma11. _ROW3_ $7. _COEF3_ comma9.4 ;
Input _TYPE_ _COL_ _ROW1_ _COEF1_ _ROW2_ _COEF2_ _ROW3_ _COEF3_ ;
datalines;
...
. 75300202_80502__T_0183 LOWER 0 UPPER 9876543210 XP 4.052
. 75300202_80502__T_0184 LOWER 0 UPPER 9876543210 XP 4.052
...
GE . EQ_LOW_M_75300202_183 . . . . .
. _RHS_ EQ_LOW_M_75300202_183 3000000 . . . .
. 75300202_80502__T_0183 EQ_LOW_M_75300202_183 1 . . . .
. 75300202_80502__T_0184 EQ_LOW_M_75300202_183 1 . . . .
...
GE . EQ_LOW_M_157790202_183 . . . . .
. _RHS_ EQ_LOW_M_157790202_183 10000000 . . . .
. 157790202_80502__T_0183 EQ_LOW_M_157790202_183 1 . . . .

Loading the data works fine -- I see the data correctly with VIEWTABLE.

Trying to run the program gives the following ERROR messages:
ERROR: The coefficient in row EQ_LOW_M and column _RHS_ is defined to be 3000000 and 10000000.
ERROR: The coefficient in row EQ_UPP_M and column _RHS_ is defined to be 3000000 and 17000000.
ERROR: The coefficient in row EQ_LOW_G and column _RHS_ is defined to be 39000000 and 120000000.
...

I looks as if the names in _ROW1_ (e.g. EQ_LOW_M_75300202_183) are only interpreted with the FIRST 8 CHARACTERS. This does only happen,
when we use SAS interactively with data from files. We use the sparsedata format as above for years now, but read the problem from oracle
with the sql statement:
create table model as select
type as _type_, col as _col_, row1 as _row1_, coef1 as _coef1_,
row2 as _row2_, coef2 as _coef2_, row3 as _row3_, coef3 as _coef3_
from GASOPT.opt_sparsedata where variante_id = &Variante;

There is no problem at all, if I use the "standard" sparsedata format interactively:

data GASOPT;
Format _TYPE_ $8. _COL_ $25. _ROW_ $28. _COEFF_ comma12.4;
Input _TYPE_ _COL_ _ROW_ _COEFF_;
datalines;
...
. 75300202_80502__T_0183 LOWER 0
. 75300202_80502__T_0183 UPPER 9876543210
. 75300202_80502__T_0183 XP 4.052
. 75300202_80502__T_0184 LOWER 0
. 75300202_80502__T_0184 UPPER 9876543210
. 75300202_80502__T_0184 XP 4.052
...
GE . EQ_LOW_M_75300202_183 .
. _RHS_ EQ_LOW_M_75300202_183 3000000
. 75300202_80502__T_0183 EQ_LOW_M_75300202_183 1
. 75300202_80502__T_0184 EQ_LOW_M_75300202_183 1
...
GE . EQ_LOW_M_157790202_183 .
. _RHS_ EQ_LOW_M_157790202_183 10000000
. 157790202_80502__T_0183 EQ_LOW_M_157790202_183 1

Thanks!
3 REPLIES 3
Philipp_SAS
SAS Employee
Hi,

The problem might be that in the format you read _ROW2_ and _ROW3_ with $7.. Try changing it to $28. Maybe LP uses the smallest or the last row variable size. You can enter a Tech Support request to have it further investigated.

By the way, OPTMODEL and OPTLP/OPTMILP are much more powerful and more modern procs for doing mathematical programming.

Philipp
deleted_user
Not applicable
Hi Philipp,

Thank you for your reply. Your guess that "Maybe LP uses the smallest or the last row variable size" was absolutely right: I changed ALL _ROWx_ to $28 format and now it works. You must admit, that this behaviour of PROC LP is a bit strange ...

Thomas
Philipp_SAS
SAS Employee
Hi Thomas,

Yes, this is a strange behavior! Thanks for pointing it out to us.

Philipp

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!

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
  • 3 replies
  • 813 views
  • 0 likes
  • 2 in conversation