Hi All,
i am reading the varaible and then using that in like statment, while doing this during comparision gwtting wrong output because of space(variable length), coul you please help.
data filesystemtable ;
infile "/home/cfile/filesystem.txt" ;
input filesystem :$30. ;
call symput('filesystem',filesystem);
run;
data Library_of_filesystem;
set mine;
where path like "&filesystem%";
keep path Library_name libref;
run;
log:
NOTE: There were 0 observations read from the data set WORK.MINE.
WHERE path like '/sas/bau/pricing/ %';
you can see as variable length is less than 30 hence space getting addedd while comparing and not getting expected result, could you please help to remove the leading space?
1) Try Call SymputX
2) what is the value of filesystem in the LAST record in the data set
3) you may need to examine that filesytem variable to see if it actually has NULL character(s) at the end and not a BLANK at the end. STRIP does not remove null characters.
Sharukhmk,
have you tried a simple solution? Try stripping the variable before assigning it.
variable = strip(variable);
Chirs
Not really clear what the problem is as we really don't know any of your data.
I would guess that you may want
call symput('filesystem', STRIP(filesystem));
strip, trim and compress tried but still same thing.
What exactly are you trying to achieve with that code?
Seems like dataset "mine" is the issue, SAS is looking for a specific table. Maybe using _null_ will help? try this....
data Library_of_filesystem;
set _null_;
where path like "&filesystem%";
keep path Library_name libref;
run;
1) Try Call SymputX
2) what is the value of filesystem in the LAST record in the data set
3) you may need to examine that filesytem variable to see if it actually has NULL character(s) at the end and not a BLANK at the end. STRIP does not remove null characters.
One way is use the Index function which returns the first position in the variable with a specified character.
data example; x='ThisHasNoBlanks'; y='ThisHas A Blank'; /*blank being the SPACE character*/ z='ThisHas Null'; /* Null character entered by typing 255 on the NUMERIC key pad while holding the ALT key*/ XhasBlank = index(x,' '); YhasBlank = index(y,' '); ZhasBlank = index(z,' '); /* space*/ ZhasNull = index(z,' '); /*ALT+255*/ run;
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!
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.