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

Data Have;

String="meiraca";

run;     

 

 

Through this data set can i get output string name as "america" ???

 

Please give a solution for this !!!!!!!                  

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

Not sure what a "10th table in SAS is" but to "throw" something at you:

data sample;
  do i=1 to 10;
    var=10*i;
    string=cats('10*',i,'=',var);
    output;
  end;
  stop;
run;

proc print data=sample;
run;

Capture.JPG

View solution in original post

17 REPLIES 17
PeterClemmensen
Tourmaline | Level 20

@Mohan_Reddy Hi and welcome to the SAS Community 🙂

 

What is the logic here? The string is not sorted in alphabetical order.. That would give "aaceimr".

Mohan_Reddy
Obsidian | Level 7

Yes Correct what you say sorting...But in my way sort means to get string name America....if you have any answer please provide here..

PeterClemmensen
Tourmaline | Level 20

What if you have the string "meiracam" (one extra 'm')? You can spell 'america' with some of the letters, but it leaves an 'm'..

 

And what if the letters can not be rearranged into 'america'. Should the string be left untouched, or?

Mohan_Reddy
Obsidian | Level 7

No problem you should remove that extra M and through that remaining string please get that America output.....

PeterClemmensen
Tourmaline | Level 20

And what if the letters can not be rearranged into 'america'. Should the string be left untouched, or?

Mohan_Reddy
Obsidian | Level 7

Ok No problem...you should consider left untouched also...if any chances to get sort string to "america" please give a solution...

andreas_lds
Jade | Level 19

This is a strange requirement. To solve it, you need to count the letters required to create the word you want, in your example something like

countc(source, 'a') >= 2 and countc(source, 'm') >= 1 and countc(source, 'e') >= 1 ...

If all conditions are true, simply set source = 'america'.

Mohan_Reddy
Obsidian | Level 7

I have dataset like below...

data ds;

do i=1 to 1000;

output;

end;

stop;

run;


Now i want output like

Using that dataset  "i" value create 3 new columns(variables).....One Variable should contain Odd numbers and


One variable should contain Even numbers..

 

Last variable should contain Prime numbers...

Please write a programme for this .......

Astounding
PROC Star

Close but not working.  I could rearrange 

 

String="maeirac";

 

But not the actual string that you posted.

 

Number the consonants sequentially.

 

Number the vowels sequentially.

 

In order, take a vowel, a consonant, a vowel, a consonant, etc.

Mohan_Reddy
Obsidian | Level 7

Thank You for your information...If you don't mind please write a full programme for solve this question if you have answer...!!!

 

 

data ds;

string="maeirac";

run;

 

If you have answer for this question please write a full programme ...!!!

Mohan_Reddy
Obsidian | Level 7
How To Create Table in SAS ???
Like 10*1=10
10*2=20
..


10*10=100

like this i want output..please give a programme for this!!!
Patrick
Opal | Level 21

@Mohan_Reddy wrote:
How To Create Table in SAS ???
Like 10*1=10
10*2=20
..


10*10=100

like this i want output..please give a programme for this!!!

It's not clear to me how your last post relates to anything you were talking about before.

As for your initial requirement: That's a really very strange one. I could now spend time and write code for exactly the america use case but it wouldn't work for anything else/any other word.

It would really help if you could explain in more detail what you have and what you need. And then also provide sample data in form of a SAS data step and show us the expected result.

I'm trying to help you here - and also not waste my time on the wrong solution. And that's also why other people are asking all these questions and are not just throwing some "random" code at you. Sooo... you need to help us a bit more to help you.

Mohan_Reddy
Obsidian | Level 7

I Really thankyou for your work..Please leave that america question if you have no answer i think that question will wrong.....please help in this my last question...

 

How to create 10th table in SAS???

 

i want output like  10*1=10

                              10*2=20

                              10*3=30

 

 

 

                               10*10=100

like this please write a programme !!!!!

Patrick
Opal | Level 21

Not sure what a "10th table in SAS is" but to "throw" something at you:

data sample;
  do i=1 to 10;
    var=10*i;
    string=cats('10*',i,'=',var);
    output;
  end;
  stop;
run;

proc print data=sample;
run;

Capture.JPG

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
  • 17 replies
  • 3186 views
  • 0 likes
  • 5 in conversation