BookmarkSubscribeRSS Feed
SASdevAnneMarie
Barite | Level 11

Hello Experts,

 

I'm wondering how to get the decimal after the sum statement, the decimal doesn't appear in my macro variable Montant_EU. My code is  :

 

proc sql noprint;
            select sum("Montant EU "n)
            into : Montant_EU 
            from base_finale;
      quit;

 Thank you for your help !

11 REPLIES 11
sbxkoenk
SAS Super FREQ

I think you don't have any decimals (the sum is an integer).

 

Anyway,

if you absolutely want decimals 

, here's one way to get them.

proc sql noprint;
            select put(avg(Weight),comma14.7) 
            into :Montant_EU trimmed 
            from sashelp.class;
quit;

%PUT &=Montant_EU;

Koen

SASdevAnneMarie
Barite | Level 11
Thank you! Why %eval function doesn't work for this macro variable :
%let tx=%eval(&Montant_EU+1) ?

PaigeMiller
Diamond | Level 26

@SASdevAnneMarie wrote:
Thank you! Why %eval function doesn't work for this macro variable :
%let tx=%eval(&Montant_EU+1) ?


What about this doesn't work?

--
Paige Miller
sbxkoenk
SAS Super FREQ

You could use "sysevalf" :

proc sql noprint;
            select put(avg(Weight),comma14.7) 
            into :Montant_EU trimmed 
            from sashelp.class;
quit;

%PUT &=Montant_EU;

%LET tx=%sysevalf(&Montant_EU.+1);
%PUT &=tx;

Koen

SASdevAnneMarie
Barite | Level 11

This code doesn't work on my EG, I have this erros :

SASdevAnneMarie_0-1713181414891.png

 

sbxkoenk
SAS Super FREQ

Can you copy / paste the full code (as part of the full log)?

 

  • Copy in EGuide
  • Then use the </> icon in the header 
  • Then paste in the pop-up window.
  • (Avoid screenshots here)

 

Thanks,
Koen

Quentin
Super User

That looks like  an un-related problem.  It looks like at some point in the SAS session, you may have submitted a block of code with unmatched quotation marks.  If you get this problem repeatedly, the easiest thing is to exit EG and then restart, and then search your code for unmatched quotation marks.

The Boston Area SAS Users Group is hosting free webinars!
Next up: Joe Madden & Joseph Henry present Putting Power into the Hands of the Programmer with SAS Viya Workbench on Wednesday Nov 6.
Register now at https://www.basug.org/events.
Tom
Super User Tom
Super User

@Quentin wrote:

That looks like  an un-related problem.  It looks like at some point in the SAS session, you may have submitted a block of code with unmatched quotation marks.  If you get this problem repeatedly, the easiest thing is to exit EG and then restart, and then search your code for unmatched quotation marks.


No need to exit Enterprise Guide.  Just restart the SAS session that Enterprise Guide is using to run the SAS code.

Quentin
Super User

@Tom wrote:

@Quentin wrote:

That looks like  an un-related problem.  It looks like at some point in the SAS session, you may have submitted a block of code with unmatched quotation marks.  If you get this problem repeatedly, the easiest thing is to exit EG and then restart, and then search your code for unmatched quotation marks.


No need to exit Enterprise Guide.  Just restart the SAS session that Enterprise Guide is using to run the SAS code.


But is there an easy way to restart the session?  The best way I have found is to right-click the server and select disconnect, then right-click again and select connect.  I would love it if there was a "restart session" button / menu item I could refer folks to.

The Boston Area SAS Users Group is hosting free webinars!
Next up: Joe Madden & Joseph Henry present Putting Power into the Hands of the Programmer with SAS Viya Workbench on Wednesday Nov 6.
Register now at https://www.basug.org/events.
Tom
Super User Tom
Super User

Disconnect/select sounds the same as restart, just in two steps instead of one.  Still better than leaving the application completely and having to restart the application.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 11 replies
  • 1629 views
  • 6 likes
  • 6 in conversation