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.

BASUG is hosting free webinars Next up: Mike Raithel presenting on validating data files on Wednesday July 17. Register now at the Boston Area SAS Users Group event page: 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.

BASUG is hosting free webinars Next up: Mike Raithel presenting on validating data files on Wednesday July 17. Register now at the Boston Area SAS Users Group event page: 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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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