BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
lamp_1234
Calcite | Level 5

In a project named "Test.egp", there is a program called "missing_var" with the following code:

 

proc means data=sashelp.class;
	class sex;
	var wieght;
run;
%put &syserr;

The value of &syserr when running the code is 3000.

 

I need to get this value of 3000 in PowerShell when running the project.

$proj_full_path = "test.egp"                
$eg_guide_app = New-Object -comObject SASEGObjectModel.Application.8.1
$current_project = $eg_guide_app.Open($proj_full_path, "")
try{
    $current_project.run
}
catch{
    $err_num = ??? #(5000)
}
$current_project.Close()
$eg_guide_app.Quit()

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

@lamp_1234 EG won't return any SAS error codes or log content directly in the script. To accomplish this, you will need to enhance your script to get the .Log object from the Code item that runs this PROC MEANS. Then you'll have to use PowerShell to scan the Log (a text object) for the error message/code you're looking for.

 

You'll need to add quite a bit of logic, and you can find some examples here: Doing More with SAS Enterprise Guide Automation

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!

View solution in original post

1 REPLY 1
ChrisHemedinger
Community Manager

@lamp_1234 EG won't return any SAS error codes or log content directly in the script. To accomplish this, you will need to enhance your script to get the .Log object from the Code item that runs this PROC MEANS. Then you'll have to use PowerShell to scan the Log (a text object) for the error message/code you're looking for.

 

You'll need to add quite a bit of logic, and you can find some examples here: Doing More with SAS Enterprise Guide Automation

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!

sas-innovate-white.png

🚨 Early Bird Rate Extended!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Lock in the best rate now before the price increases on April 1.

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 645 views
  • 0 likes
  • 2 in conversation