☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
<!#-- DETERMINE THREAD OR REPLY --> <!#-- GET THE MESSAGE ID AND DATA, EITHER WAY -->
<!#-- ASSIGN MESSAGE AND AUTHOR QUERIES APPROPRIATELY -->
Idi
Obsidian | Level 7
Go to Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Replacing values with text but got just 2 characters
<!#-- DETERMINE THREAD OR REPLY -->
Posted Thursday (279 views)
Hello ,
I have data with multiples columns : A -- Q
Inside the column i have 3 valies : N/A , Yes , No
I want to replace Yes with a text like :
If A = Yes then A = "L'utilisateur marche bien "
But i got only : L'u
And i want to replace all the N/A and No with blank : " " just blank.
Can you help please ?
Thanks so much
0Likes
Reply
1 ACCEPTED SOLUTION
Accepted Solutions
<!#-- DETERMINE THREAD OR REPLY --> <!#-- GET THE MESSAGE ID AND DATA, EITHER WAY -->
<!#-- ASSIGN MESSAGE AND AUTHOR QUERIES APPROPRIATELY -->
PaigeMiller
Diamond | Level 26
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Re: Replacing values with text but got just 2 characters
<!#-- DETERMINE THREAD OR REPLY -->
Posted Thursday (254 views) | In reply to Idi
Easier would be to use custom format
proc format; value $fmt 'Yes'="L'utilisateur marche bien" 'No','N/A'=' ';run;data want; set have; format a--q $fmt.;run;
The reason your code won't work without modification is that A--Q has a length of 3 characters, this doesn't change when assigning the valueL'utilisateur marche bien, you only get the first 3 characters. You would need use a LENGTH statement to change this.
length a--q $ 25;
because the text you want is 25 characters. But really, use the easier approach which is PROC FORMAT above.
--
Paige Miller
View solution in original post
- Tags:
- Thank you so much its works very well. Just another question : if the string value IS différent for B C ... Q . I Have différent text value for each columns. For A= "l'utilisateur marche bien". I have another text for B etc -- Q
1Like
Reply
5 REPLIES 5
<!#-- DETERMINE THREAD OR REPLY --> <!#-- GET THE MESSAGE ID AND DATA, EITHER WAY -->
<!#-- ASSIGN MESSAGE AND AUTHOR QUERIES APPROPRIATELY -->
PaigeMiller
Diamond | Level 26
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Re: Replacing values with text but got just 2 characters
<!#-- DETERMINE THREAD OR REPLY -->
Posted Thursday (255 views) | In reply to Idi
Easier would be to use custom format
proc format; value $fmt 'Yes'="L'utilisateur marche bien" 'No','N/A'=' ';run;data want; set have; format a--q $fmt.;run;
The reason your code won't work without modification is that A--Q has a length of 3 characters, this doesn't change when assigning the valueL'utilisateur marche bien, you only get the first 3 characters. You would need use a LENGTH statement to change this.
length a--q $ 25;
because the text you want is 25 characters. But really, use the easier approach which is PROC FORMAT above.
--
Paige Miller
- Tags:
- Thank you so much its works very well. Just another question : if the string value IS différent for B C ... Q . I Have différent text value for each columns. For A= "l'utilisateur marche bien". I have another text for B etc -- Q
1Like
Reply
<!#-- DETERMINE THREAD OR REPLY --> <!#-- GET THE MESSAGE ID AND DATA, EITHER WAY -->
<!#-- ASSIGN MESSAGE AND AUTHOR QUERIES APPROPRIATELY -->
PaigeMiller
Diamond | Level 26
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Re: Replacing values with text but got just 2 characters
<!#-- DETERMINE THREAD OR REPLY -->
Posted Thursday (236 views) | In reply to PaigeMiller
@Idi Please don't write followup questions in the field for tags. Please write your followup question by clicking on "Reply".
--
Paige Miller
0Likes
Reply
<!#-- DETERMINE THREAD OR REPLY --> <!#-- GET THE MESSAGE ID AND DATA, EITHER WAY -->
<!#-- ASSIGN MESSAGE AND AUTHOR QUERIES APPROPRIATELY -->
Idi
Obsidian | Level 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Re: Replacing values with text but got just 2 characters
<!#-- DETERMINE THREAD OR REPLY -->
Posted Thursday (213 views) | In reply to PaigeMiller
Thank you so much its works very well. Just another question : if the string value IS différent for B C ... Q . I Have différent text value for each columns. For A= "l'utilisateur marche bien". I have another text for B etc -- Q
0Likes
Reply
<!#-- DETERMINE THREAD OR REPLY --> <!#-- GET THE MESSAGE ID AND DATA, EITHER WAY -->
<!#-- ASSIGN MESSAGE AND AUTHOR QUERIES APPROPRIATELY -->
PaigeMiller
Diamond | Level 26
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Re: Replacing values with text but got just 2 characters
<!#-- DETERMINE THREAD OR REPLY -->
Posted Thursday (204 views) | In reply to Idi
Then you will need different formats for each variable.
--
Paige Miller
0Likes
Reply
<!#-- DETERMINE THREAD OR REPLY --> <!#-- GET THE MESSAGE ID AND DATA, EITHER WAY -->
<!#-- ASSIGN MESSAGE AND AUTHOR QUERIES APPROPRIATELY -->
Idi
Obsidian | Level 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Re: Replacing values with text but got just 2 characters
<!#-- DETERMINE THREAD OR REPLY -->
Posted Thursday (221 views) | In reply to PaigeMiller
Thank you so much
0Likes
Reply