Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 09-13-2018 11:03 AM
(1064 views)

Hi Geeks,

I am trying to run SAS OPTGRAPH Procedure as to learn more about Travelling Salesman problem (for ShortestPath) using SAS 9.2 version but unfortunately I keep getting "ERROR: 22-322, Expecting an Integer Constant" where more details of this error is in the attached picture.

I followed the same instructions in this SAS Support Forum .

The sample data includes two nodes (the starting point which is classified as "FROM" and the end point classified as "TO") in addition to the weight of this transaction coded as below:

STEP 1: Loading the data

`data LinkSetIn;input from $ to $ weight @@;datalines;A B 1.0 A C 1.0 A D 1.5 B C 2.0 B D 4.0B E 3.0 C D 3.0 C F 3.0 C H 4.0 D E 1.5D F 3.0 D G 4.0 E F 1.0 E G 1.0 F G 2.0F H 4.0 H I 3.0 I J 1.0 C J 5.0 F J 3.0F I 1.0 H J 1.0;`

Step 2: Run PROC OPTGRAPH MACRO

`proc optgraphloglevel = moderatedata_links = LinkSetInout_nodes = NodeSetOut;tspout = TSPTour;run;%put &_OPTGRAPH_;%put &_OPTGRAPH_TSP_;`

and the error is:

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Please try this link instead:

https://www.iwr.uni-heidelberg.de/groups/comopt/software/TSPLIB95/

7 REPLIES 7

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

There is no need to go through extra steps to make images of logs and paste them. Best is to copy directly from the log and then paste into a code window opened with either of the forums {I} or "running man" icons.

The error about the expected integer constant means that the procedure is looking for just that: a number such as

loglevel=2

The "out of order" error often is associated with placing a semicolon before a Proc option. The ; would end the procedure statement so the option is not valid in the location of the code encountered.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

The TSP statement was not added to PROC OPTGRAPH until version 12.3 (SAS 9.4):

http://support.sas.com/documentation/solutions/optgraph/index.html

You can also access the TSP algorithm via PROC OPTNET or PROC OPTMODEL (solve with network) in SAS/OR, or via PROC OPTNETWORK or the Network Optimization action set in SAS Optimization on SAS Viya.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thanks for this useful reply but when I ran PROC OPTNET I keep getting "ERROR: Procedure Not Found", it seems that it is also supported from 9.3 (where I have 9.2) Right?

For PROC OPTMODEL , I followed the same instructions as in this SAS Support TSP:

```
data LinkSetIn;
input from $ to $ weight @@;
datalines;
A B 1.0 A C 1.0 A D 1.5 B C 2.0 B D 4.0
B E 3.0 C D 3.0 C F 3.0 C H 4.0 D E 1.5
D F 3.0 D G 4.0 E F 1.0 E G 1.0 F G 2.0
F H 4.0 H I 3.0 I J 1.0 C J 5.0 F J 3.0
F I 1.0 H J 1.0
;
proc optmodel;
set<str,str> EDGES;
set<str> NODES = union{<i,j> in EDGES} {i,j};
num weight{EDGES};
read data LinkSetIn into EDGES=[from to] weight;
num tsp_order{NODES};
set<str,str> TOUR;
solve with NETWORK /
loglevel = moderate
links = (weight=weight)
tsp
out = (order=tsp_order tour=TOUR)
;
put TOUR;
print {<i,j> in TOUR} weight;
print tsp_order;
create data NodeSetOut from [node] tsp_order;
create data TSPTour from [from to]=TOUR weight;
quit;
```

but I got the following error as well:

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

PROC OPTNET was released in August 2012 with SAS/OR 12.1 (on SAS 9.3M1).

The SOLVE WITH NETWORK statement was added to PROC OPTMODEL in December 2013 with SAS/OR 13.1 (on SAS 9.4M1).

I would strongly recommend that you upgrade to the latest release (SAS/OR 14.3 on SAS 9.4M5) to take advantage of these features and to benefit from the significant performance improvements over the last several years. Until then, you might be interested in the subtour formulation from this SAS/OR 9.22 example:

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thanks again for your reply,

I checked this article before, but the library at http://elib.zib.de/pub/Packages/mp-testdata/tsp/tsplib/tsplib.html is not found. This is where I should start.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Please try this link instead:

https://www.iwr.uni-heidelberg.de/groups/comopt/software/TSPLIB95/

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

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.