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

Hello,

From a proc tabulate , I get the average score of a variable for levels of of a class variable then I create a character variable that include all these values as a string

retain seriesYou seriesOthers  ;

    seriesYou = catx(',',seriesYou,&YouAsDirMgr) ;

The problem is that the values in the sting appear unformatted (3.31131313,4.4546464656....) while I want them to appear as (3.31,4.45...)

Any help

Abe

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

If I understand what &YouAsDirMgr might contain (a list of variable names or numbers), you could use it in the list form of a DO loop :

%let YouAsDirMgr=a,b,123.12345;

data _null_;
length str $200;
a = 345.876543;
b = 987;
seriesYou = 9.9889;
do v = seriesYou, &YouAsDirMgr.;
     str = catx(",", str, round(v, 0.01));
     end;
put str=;
run;

PG

PG

View solution in original post

2 REPLIES 2
jakarman
Barite | Level 11

use the put function

---->-- ja karman --<-----
PGStats
Opal | Level 21

If I understand what &YouAsDirMgr might contain (a list of variable names or numbers), you could use it in the list form of a DO loop :

%let YouAsDirMgr=a,b,123.12345;

data _null_;
length str $200;
a = 345.876543;
b = 987;
seriesYou = 9.9889;
do v = seriesYou, &YouAsDirMgr.;
     str = catx(",", str, round(v, 0.01));
     end;
put str=;
run;

PG

PG

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 2 replies
  • 866 views
  • 3 likes
  • 3 in conversation