Help using Base SAS procedures

Incorrect values is datasets imported from CSV.

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 6
Accepted Solution

Incorrect values is datasets imported from CSV.

Hello,

          I am a newbie to SAS and I am trying to import a CSV file into SAS Dataset . The import was successful. However the format of 16 digit long numeric values are represented as exponential values in SAS observations(TranID, CreditCardNo) in a particular datset. So can you please let me know how to view TranId, CreditCardNo as a normal 16 digit number in SAS Tables.

Capture.JPG

Thanks,

Sankar.


Accepted Solutions
Solution
‎10-06-2014 01:52 PM
Super User
Posts: 10,500

Re: Incorrect values is datasets imported from CSV.

Are you going to use those for computation such as total TranId or average TranID? If not import them as character. If you imported them using proc import it makes a guess as to the data type something should be and if all digits then assumes they are numeric. Which will have issues with many ID values. Besides the appearance which is just the display format associated but numeric precision means that 16 digit numeric are not likely to be accurately stored.

Proc import, guessing that is what you used, will generate SAS datastep code that can (and often should) be modified to control import and display format. It is likely that you would see lines like:

informat TranID best16. ; Change them to informat TranId $16. ;

View solution in original post


All Replies
PROC Star
Posts: 7,363

Re: Incorrect values is datasets imported from CSV.

Import those two fields as character variables with a length of 16. If you used proc import, modify the code that it produced (which should be shown in your log).

Solution
‎10-06-2014 01:52 PM
Super User
Posts: 10,500

Re: Incorrect values is datasets imported from CSV.

Are you going to use those for computation such as total TranId or average TranID? If not import them as character. If you imported them using proc import it makes a guess as to the data type something should be and if all digits then assumes they are numeric. Which will have issues with many ID values. Besides the appearance which is just the display format associated but numeric precision means that 16 digit numeric are not likely to be accurately stored.

Proc import, guessing that is what you used, will generate SAS datastep code that can (and often should) be modified to control import and display format. It is likely that you would see lines like:

informat TranID best16. ; Change them to informat TranId $16. ;

Occasional Contributor
Posts: 6

Re: Incorrect values is datasets imported from CSV.

Thanks for providing the solution ballardw. Its Working now :smileygrin:

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 728 views
  • 0 likes
  • 3 in conversation