BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Chrishi
Calcite | Level 5


I am converting sas dataset to sas XPT files. The numeric missing data in the Xpt file is showing as 'blank' where as in dataset it is showing as '.' i.e. period. How can i get the '.' representation in XPT as well.

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

So there is your answer then.  XPT file format does not hold '.'s as missing values, this is determined by your SAS system options when you open a dataset.  XPT is used for transporting datasets from one system to another, then once the data is there it is viewed in SAS using its options setup.

SAS Viewer doesn't have the options setup, so it just reads the file as is and displays it - i.e. it doesn't do the extra step of displaying blanks as .

To clarify above (was blathering a bit as lunch time):

SAS adds a layer of masking to the data based on your options setup, much like applying a format, SAS Viewer doesn't have that so you see the actual stored information.

View solution in original post

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Well, I haven't tested this, but from memory the XPT file format is a transport file format.  I.e. it stores the data for sending elsewhere.  That data is then upacked into the recipients system using the SAS system options.  So you see the dataset in your system which has:

options missing='.';

So, how are you viewing the XPT, is it by opening it in SAS, or opening in SAS viewer, or actually proc copy'ing the dataset.  I would suggest copying it back into your system and seeing what the copied dataset looks like.

Chrishi
Calcite | Level 5

I am using sas viewer to open xpt file and i have used proc copy to create the xpt file. As you suggested i have copied back the xpt file to dataset and it looks fine numeric missing values are represented as '.'

RW9
Diamond | Level 26 RW9
Diamond | Level 26

So there is your answer then.  XPT file format does not hold '.'s as missing values, this is determined by your SAS system options when you open a dataset.  XPT is used for transporting datasets from one system to another, then once the data is there it is viewed in SAS using its options setup.

SAS Viewer doesn't have the options setup, so it just reads the file as is and displays it - i.e. it doesn't do the extra step of displaying blanks as .

To clarify above (was blathering a bit as lunch time):

SAS adds a layer of masking to the data based on your options setup, much like applying a format, SAS Viewer doesn't have that so you see the actual stored information.

Chrishi
Calcite | Level 5

Thanks for the help Smiley Happy

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!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1429 views
  • 5 likes
  • 2 in conversation