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

I'm importing a sas7bdat file in sas studio using proc import and one of the variables in the dataset is changing to scientific notation, e.g, 1234567891011121 is showing up as 1.2345678E15

 

I'm fairly new to SAS and not sure what function would help retain this particular column in its original 16 digit format instead of scientific notation. This column is of numeric data type and its length is being displayed as 8. I have been through other similar posts, but could not find a solution to work with.

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Asssign a format which is wide enough to accomodate the digits.

Note that 16 decimal digits are right on the verge of numeric precision in SAS, so some of the numbers might not be exactly what was imported into SAS in the first place.

View solution in original post

7 REPLIES 7
SASKiwi
PROC Star

SAS7BDAT files are already SAS datasets and don't need to be imported. All you need to do is assign a LIBREF using a LIBNAME statement to the folder they are stored in to be able to read them:

libname MyLib '\MyFolder';
hk24
Obsidian | Level 7
Thank you for your response! Libname assigns a libref to the data, but how can I read and view this data in a table format in sas studio? Sorry, I'm still trying to learn sas
Tom
Super User Tom
Super User

The easiest thing to do is to look at the data using CODE.

If the dataset is small just print it.

proc print data='/home/myname/mydata.sas7bdat';
run;

If you want to interactively examine the dataset using SAS/Studio then point a libref to the folder where the dataset lives.

libname mylib '/home/myname/';

And then use the LIBRARIES section of the left hand panel to find the libref you defined (MYLIB in my example) and the dataset (MYDATA in my first example code).  You can open the dataset viewer widget of SAS/Studio from there.

SASKiwi
PROC Star

The easiest way is to expand the list of SAS data connections in the SAS Studio Server Pane, expand your LIBREF, select the table, right click to select Properties, then Open.

 

You really should watch some of the SAS Studio "how to" videos in the Learn Community. It's a lot faster than asking a Community question each time you have a problem.

Kurt_Bremser
Super User

Asssign a format which is wide enough to accomodate the digits.

Note that 16 decimal digits are right on the verge of numeric precision in SAS, so some of the numbers might not be exactly what was imported into SAS in the first place.

minatakry
Calcite | Level 5

I have a dataset that has over 16 mil observations/rows. When I export it to CSV, column record ID convert to scientific notation. How do I keep the format the same or remove scientific notation ? If not CSV, any other file I can export large dataset to? Im new to SAS.

ballardw
Super User

@minatakry wrote:

I have a dataset that has over 16 mil observations/rows. When I export it to CSV, column record ID convert to scientific notation. How do I keep the format the same or remove scientific notation ? If not CSV, any other file I can export large dataset to? Im new to SAS.


What program are you using to examine the CSV?If it is a spread sheet and it's rules are displaying a value to fit in a cell. If widening a cell makes the value display with more digits that is the issue.

If your are examining the file with a text editor then you may need to investigate the FORMAT that was assigned to the variable in the SAS data set and make it a wider prior to export.

 

Please refrain from adding on to other posts. If you find one that is relevant then make your own thread and post a link to the related the thread. As author of a post you have the ability to indicate an accepted solution.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 7 replies
  • 2120 views
  • 0 likes
  • 6 in conversation