BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
1 ACCEPTED SOLUTION

Accepted Solutions
ed_sas_member
Meteorite | Level 14

Hi @Risi 

 

You can try this:

 

NB: The WORDSw. format converts numeric values to their equivalent in English words.

data have;
	input V1$;
	datalines;
one
two
three
seven
;
run;

data convert;
  do num=1 to 100;
    V1=put(num,words100.);
    output;
  end;
run;

proc sql noprint;
	create table want as
	select a.V1, b.num
	from have as a left join convert as b on a.V1 = b.V1
	order by a.V1;
quit;


HaveHave

 

WantWant

 

 

 

View solution in original post

3 REPLIES 3
ed_sas_member
Meteorite | Level 14

Hi @Risi 

 

You can try this:

 

NB: The WORDSw. format converts numeric values to their equivalent in English words.

data have;
	input V1$;
	datalines;
one
two
three
seven
;
run;

data convert;
  do num=1 to 100;
    V1=put(num,words100.);
    output;
  end;
run;

proc sql noprint;
	create table want as
	select a.V1, b.num
	from have as a left join convert as b on a.V1 = b.V1
	order by a.V1;
quit;


HaveHave

 

WantWant

 

 

 

ballardw
Super User

Details matter.

Do you mean to change a TEXT value of 'one' to a numeric value of 1 for computation?

Or just to display a text value of 'one' as text value of '1'?

How many of these the text values are involved? Just 'one' and 'two' or a large number? Are there other text values in the variable that are not "numbers" such as "NA" or "missing".

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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