BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
JackZ295
Pyrite | Level 9

Hi! I was trying to read in a data set into SAS, but I ran into the following issue in my log: 

 

WARNING: Some character data was lost during transcoding in column: sq105j_s at obs 3739.
WARNING: Some character data was lost during transcoding in column: sh102c at obs 14322.
WARNING: Some character data was lost during transcoding in column: db107_s at obs 16615.
WARNING: Some character data was lost during transcoding in column: ue115b at obs 21310.

 

I want to print out the data set and reference those observation numbers to see why those particular observations have issues. 

 

How would I go about referring to the observation number in my SAS code (I know there is a built in SAS variable for observation number)? When I tried utilizing the _N_ variable, it didn't seem to work. Any input regarding this would be much appreciated! Thanks so much! 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

It really depends on what code you ran that produced those notes.

 

If you just did something simple like:

data want;
  set have;
run;

Then you could use the _N_ automatic variable in another data step to filter to just the observations mentioned in the log.

data problems ;
  set have;
  if _n_ in (3739 14322 16615 21310);
run;

But to really see what was in that data that caused the transcoding issue you will want to read it without transcoding. So you might want to add ENCODING=ANY dataset option.

data problems ;
  set have (encoding=any);
  if _n_ in (3739 14322 16615 21310);
run;

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

It really depends on what code you ran that produced those notes.

 

If you just did something simple like:

data want;
  set have;
run;

Then you could use the _N_ automatic variable in another data step to filter to just the observations mentioned in the log.

data problems ;
  set have;
  if _n_ in (3739 14322 16615 21310);
run;

But to really see what was in that data that caused the transcoding issue you will want to read it without transcoding. So you might want to add ENCODING=ANY dataset option.

data problems ;
  set have (encoding=any);
  if _n_ in (3739 14322 16615 21310);
run;
JackZ295
Pyrite | Level 9

Thanks so much for your help @Tom !

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 541 views
  • 1 like
  • 2 in conversation