BookmarkSubscribeRSS Feed
bismilla
Calcite | Level 5

I want to every second string in upcase

6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20

Do you mean every second word in a string or every second observation?

bismilla
Calcite | Level 5

second observation by using data sets

Shmuel
Garnet | Level 18

data want;

 set have;

       retain flag 0; drop flag;

      array varx $ _character_;

      if flag=0 then do;

         output;

         flag=1;

    end;

    else

    do i=1 to dim(varx);

          varx(i) = upcase(varx(i));

          output;

          flag=0;

     end;

run;

PeterClemmensen
Tourmaline | Level 20
data have;
input string $20.;
datalines;
here
are
some
strings
;

data want;
   set have;
   if mod(_N_, 2)=0 then string=upcase(string);
run;
andreas_lds
Jade | Level 19

Please edit the title and add something meaningful. The word "sas" does not tell anybody anything about the issue you need to be solved.

 

You should although add data in usable format (data step with datalines) and explain. based on the input you show, what do expect as result.

Onizuka
Pyrite | Level 9

@andreas_lds wrote:

Please edit the title and add something meaningful. The word "sas" does not tell anybody anything about the issue you need to be solved.

 

You should although add data in usable format (data step with datalines) and explain. based on the input you show, what do expect as result.


He also has the right to say "Hello" don't you think ? haha

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 6 replies
  • 560 views
  • 1 like
  • 5 in conversation