BookmarkSubscribeRSS Feed
TanaraRose
Calcite | Level 5

When we create a dataset from a other, sobre characteres variables "change" its length.

 

For example:

 

data new_dataset;

set old_dataset;

keep email name;

where control = 0;

run;

 

But when we see the results, the name "Alexandre" changes to "Alexandr", but when we double click we can see a hidden "e".

The same happens to email variable.

 

The problem is that when I export to a TXT file, the name exports as "Alexandr".

3 REPLIES 3
PaigeMiller
Diamond | Level 26

Could you please clarify something?

 

Where do you see this shortened version of the text?

 

Are you looking in Viewtable? If so, that's not unusual for the Viewtable to show a truncated text string, but the text is all there, as you said, you can expand the field and see it all, it's nothing to worry about.

--
Paige Miller
TomKari
Onyx | Level 15

Something a little odd is going on here.

 

First, I replicated your code, and as I expected the name field comes out at the full length.

 

So, either something odd is happening in your environment, or there's another explanation.

 

I suspect there is a $8. format on your variable. This will be copied through the data step, and EG will use it as guidance in how to display the variable.

 

Not sure about the export.

 

I suggest you run this little piece of code. It will create a SAS dataset of one record, containing information about your new dataset.

 

data test_dataset;

set old_dataset;

keep name;

where control = 0;

run;

proc datasets nolist nodetails;

contents data=test_dataset out=dataset_description noprint;

quit;

proc delete data=test_dataset;

run;

 

Look at the following:

 

TYPE: should be 2 (character)
LENGTH: should be long enough to contain Alexandre. If it's 8, there's something odd happening.
FORMAT, FORMATL: These are the fields that will show if there's a format on your variable. If there's a character format with a length of 8 on it, that's your problem. Just remove or modify it.

 

If none of the above seem to be an issue, post the dataset created by this code; it should contain the clues needed.

Tom

 

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 722 views
  • 0 likes
  • 4 in conversation