Hi,
iam trying to filter the column where flg not missing.
but iam still getting blank values whose records does not have flag.
i tried compress(flg) and strip(flg) options.but not wotking.
please help.
Thanks all for your help.
Actually for flg column mainframe team is sending the null values in it.so beacuse of this SAS treated null value as value,even thought it do not have actual values.
i requested them to remove null values and send to SAS.
now it looks good.thanks
Hi @JJP1
Coud you please share a portion of your data and the code you tried?
Did you tried then NMISS() function to filter you data for example?
Hi,
you may have a non printable character in your flg variable, try to analyse which values it contains:
data want;
set have;
do i=1 to length(flg);
rank=rank(substr(flg,i,1));
output;
end;
run;
proc print;run;
- Cheers -
Hi @Oligolas ,
i ran below code and i can see Y or N.how can i find out non printable character and resolve the issue please.
data want(keep=flg);
set have
do i=1 to length(flg);
rank=rank(substr(flg,i,1));
output;
end;
run;
proc print;run;
@JJP1 The number you get in the rank column stands for the ASCII code.
You'll know your variable contains a non-printable character whenever you get a number <= 31.
With this you'll be able to specifically aim at a sign you would like to handle.
- Cheers -
data want; set have; if not anyspace(flg); run;
Thanks @Ksharp ,
actually i need to do it using proc sql option please and iam trying below option and it says that " Variable Flg not appended because of type mismatch."would you please help
proc sql;
create table work.W5II6SX as
select
(anyspace(Flg )) asFlg length = 1
from &etls_lastTable
;
quit;
%let SYSLAST = work.W5II6SX;
%let etls_lastTable = &SYSLAST;
Actually iam getting these values from mainframe application in the form of text file.whether the mainframe is causing the issue and sending some incorrect data please .
no data is showing just blank spaces i can see.please help
How do you get the file, and how do you read it? Dealing with EBCDIC-coded data can be tricky on another platform.
Thanks all for your help.
Actually for flg column mainframe team is sending the null values in it.so beacuse of this SAS treated null value as value,even thought it do not have actual values.
i requested them to remove null values and send to SAS.
now it looks good.thanks
@JJP1 wrote:
Actually iam getting these values from mainframe application in the form of text file.whether the mainframe is causing the issue and sending some incorrect data please .
no data is showing just blank spaces i can see.please help
You need to show more details to get more help. Are you trying to use a data step to read a text file and convert it into a SAS dataset? Do you already have a SAS dataset? Are you getting errors (or informative notes) in the SAS log. Show in detail what you are doing and how it does not match what you need.
Along the same lines as what @Oligolas has said about there potentially being non-printable characters in the flg variable, you could try something like the following code after you've filtered your data and if you get some records in the have data set then those are the ones that have non-printable characters. Your original data will have have to either be read in correctly or pre-processed to remove the non-printable characters.
The code removes printable characters and checks if the result is blank.
data want;
set have;
flg2 = compress(flg,,'w');
if flg2 ne '';
run;
Regards,
Amir.
Or:
data WANT;
set HAVE;
FLG2 = prxchange('s/[:^print:]/ /o',-1,FLG);
if FLG2 ne '';
run;
to target more than white spaces.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.