BookmarkSubscribeRSS Feed
SASdevAnneMarie
Barite | Level 11

Hello Experts,

 

Do you know please ho to replace all "."  in all columns by the ",".

I run this code, but I have no columns in my data result :

 

array Var _character_;
            do over Var;
            Var=tranwrd(Var,'.',',');
            end;

 Thank you for your help !

3 REPLIES 3
andreas_lds
Jade | Level 19

Please post the complete log of the step you used.

Patrick
Opal | Level 21

The code snippet you've posted is syntactically correct and should work ...as long as you run it AFTER the location in the data step where the character variables of interest get created during the compilation phase (i.e. after a set, merge, attrib etc. statement).

 

Tom
Super User Tom
Super User

@SASdevAnneMarie wrote:

Hello Experts,

 

Do you know please ho to replace all "."  in all columns by the ",".

I run this code, but I have no columns in my data result :

 

array Var _character_;
            do over Var;
            Var=tranwrd(Var,'.',',');
            end;

 Thank you for your help !


That will not create zero variables.  It won't create ANYTHING at all. 

 

You need to include that code in a DATA step.

data want;
  set have;
  array Var _character_;
  do over Var;
    Var=tranwrd(Var,'.',',');
  end;
run;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 3 replies
  • 563 views
  • 0 likes
  • 4 in conversation