Has anyone run into an issue like this:
1) Run code
2) Your code returns an error
3) You stop running the code to address the error.
4) You fix the error.
5) You hit Run again. Except instead of running newly submitted code, it runs the previously submitted code from the point at which it stopped.
I have reached out to SAS's technical support but they have refused to help.
If you are using a free or low-cost metered offering (like SAS OnDemand for Academics or SAS Viya on Microsoft Azure Marketplace), then the official first line of support will be here, in the community. Otherwise I think SAS Tech Support would be happy to help you and track your issue/question. Note that SAS Tech Support consultants often respond to questions in the community as well.
As far as your specific question, the Run button (or key shortcut like F3) should submit the full program as you see it in the editor, or submit the statements you have selected (if you have a subset of code selected).
@toomanystepsint wrote:
Has anyone run into an issue like this:
1) Run code
2) Your code returns an error
3) You stop running the code to address the error.
4) You fix the error.
5) You hit Run again. Except instead of running newly submitted code, it runs the previously submitted code from the point at which it stopped.
I have reached out to SAS's technical support but they have refused to help.
I have never seen this. But I suspect the key questions are what did you do go from step (2) to step (3)? And what do you mean by "hit Run" in step (5)? Usually I submit code, but perhaps that is because I still mainly use Display Manager. I run programs from the command line by typing the command sas followed by the name of the program that contains the SAS code.
What type of SAS session are you running?
How exactly do you "hit run"?
I think I know a way that might force this behavior in the SAS Display Manager but not with the default set up for the Keys or submit command.
I can relate to this,
I come from a C/C++, Java, PL/SQL and VB script background and only started SAS programming 2 months back, I can be very honest, I find SAS programming really drab! The language is counterintuitive, I keep searching online for really simple commands such as outputing macros in logs etc and when I try it out, nothing appears, numerous times I get syntax errors for simple if-then-else statements. Why not have just one standard syntax for if-then-else?? The introduction of do inside it complicates everything for nothing, and then reading from files and formats and comparing string formats is only the beginning of trouble. Really I am beginning to hate this language, I wish something could be done to improve the syntax without overtly complicating things.
@Davnmu wrote:
I can relate to this,
I come from a C/C++, Java, PL/SQL and VB script background and only started SAS programming 2 months back, I can be very honest, I find SAS programming really drab! The language is counterintuitive, I keep searching online for really simple commands such as outputing macros in logs etc and when I try it out, nothing appears, numerous times I get syntax errors for simple if-then-else statements. Why not have just one standard syntax for if-then-else?? The introduction of do inside it complicates everything for nothing, and then reading from files and formats and comparing string formats is only the beginning of trouble. Really I am beginning to hate this language, I wish something could be done to improve the syntax without overtly complicating things.
I challenge you with C/C++, Java, Pl/Sql or VB script to take a data with 2 categorical character variables and 100 numeric variables to create a summary of the numeric variables that will have the mean, sum, stddev, skewness and kurtosis of each variable grouped by 1) the data set overall, 2) each level of the first character variable, 3) each level of the second character variable and 4) each combination of the two character variables. Using only 5 lines of code.
Go ahead, show me.
I can do that in SAS. And one of those lines is "Run;"
Different languages, different strengths, different weaknesses.
Complain about something without an example just tells me you likely did not bother to actually pay attention to the syntax rules. Things that one language does often do not translate into another but your "experience" leads you try them.
What does "outputting macros in logs" mean?
I am afraid that you will have to show what you mean by different if/then/else constructs. And SAS is not the only language that requires a do/end or similar construct to execute multiple statements with a branch of a "then" or "else".
A C program complaining abut "overly complicating".
BTW SAS has a Proc PROTO that actually allows use of C/C++ code by registering the external functions and SAS can then use then. Show be where in C or C++ the registration of using SAS Proc Summary to allow the 5 line program that does what I mention above.
@Davnmu wrote:
I can relate to this,
I come from a C/C++, Java, PL/SQL and VB script background and only started SAS programming 2 months back, I can be very honest, I find SAS programming really drab! The language is counterintuitive, I keep searching online for really simple commands such as outputing macros in logs etc and when I try it out, nothing appears, numerous times I get syntax errors for simple if-then-else statements. Why not have just one standard syntax for if-then-else?? The introduction of do inside it complicates everything for nothing, and then reading from files and formats and comparing string formats is only the beginning of trouble. Really I am beginning to hate this language, I wish something could be done to improve the syntax without overtly complicating things.
Do not try to use the macro language to generate code until you have enough experience at actually writing the code to know what code you want the macro language to generate.
I say that's a very "judgemental" question. It's like asking "why this car suck so much?" when you have to use manual gear box instead automatic. But that's just my opinion (and since I have no more data) we can go to the point now.
There could be few possible situations which I can imagine:
1) if you are using Display Manager, after rewriting the code you could by mistake hit F4 instead F3 (F4 resubmits previously written code),
2) your code didn't have "RUN" statement at the end, when you rewrote it and run again new data step indicated the end of previous and the old code ran,
3) code you wrote had some unmatched quotes which cause that part of the code was masked as a string,
4) code you wrote had some unmatched macro language elements which didn't run,
5) code you wrote had an error which "hanged" the word scanner and the macroprocesor in such a way that they were still awaiting code when you rewrote your code.
There is plenty of options.
If you could share your code (the original one and printout of the log) it would be easier to discuss... But as I said... since we don't have data we can only share opinions...
Bart
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.