Hello
among almost 100 file within a library (libname= "wsaslib") I'm trying to find all datasets (memname) that contains a value of "NONE" and I'm trying to do so for the following cases
1- if the variable is character only
2- if the variable contain both numeric and character variables
Thanks
So you need to find all datasets that have a character variable that contains 'NONE' at least once? Or do you also want numeric variables where a formatted value resolves to 'NONE'?
Yes that is exactly what I'm looking for if 'None' as a character variable appeared at least once given that
1- all the variable values where 'None' appeared are of characters type only.
2- the variable values where the 'None' appeared is either characters or numeric.
Thanks
@Abdulla1 wrote:
Yes that is exactly what I'm looking for if 'None' as a character variable appeared at least once given that
1- all the variable values where 'None' appeared are of characters type only.
2- the variable values where the 'None' appeared is either characters or numeric.
Thanks
You did not answer the question.
How do you expect the search for the word None in a numeric field? There is no place to store letters. The question was do you want to check the formatted values of the numeric variables, in case they have a user defined format attached to them (and the format is available in one of the catalogs listed in the FMTSEARCH system option).
Plus there are other questions.
The main one being WHY? What is the real world problem such code would solve.
Please clarify that you want to search the values of the variables and not the names of the variables or the names of the datasets for the string 'None'.
Do you only want to search for 'None'? What about 'NONE' or 'none' or even ' None'? In SAS string comparisons are case sensitive. And leading spaces in a the value of a variable are significant. Trailing spaces are not significant since SAS stores character variables as FIXED length strings, padding them with spaces to their full length.
What is the result you want? A list of the datasets where NONE was found? A list of the variables where NONE was found? A list of the observations where NONE was found? If the later do all of the database have common key variables you could include in the list to properly identify the observation(s) where NONE was found.
1- "How do you expect the search for the word None in a numeric field?"
within the numeric only field I don't want to search for the word 'None', in another word I don't want to check for the formatted value of the numeric field.
2- What is the real world problem such code would solve.
there are actually two different problems that I'm trying to solve.
a- I'm unable to get a specific data by the variable name as it is probably stored under different name other that I'm expecting. rather, I believe that the variable may have specific characters in it's fields such as 'None'. I need to locate in which datasets I can find this variable. and to limit the outputs I know that all values within the variable are of of character type and none of them is numeric, if that is not possible then no problem.
b- at few of the datasets I have missing values for customers phone number, these missing fields are filled with 'None' as character value. I need to locate such datasets knowing that the variable phone number is sometimes stored as phone, contact, mobile, ... and many other different names at different datasets.
3- Do you only want to search for 'None'?
For now yes only the word 'None' and I can then play with the code afterwards. and btw, thanks for notifying me about all the different possibilities.
4- What is the result you want?
I'm actually looking for a list of the datasets where 'None' was found?
Thank you
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.