DATA Step, Macro, Functions and more

Viewing SAS catalog entries and formats within SAS Enterprise Guide

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 126
Accepted Solution

Viewing SAS catalog entries and formats within SAS Enterprise Guide

Hi SAs users,

 

I needed some help with loading the Claim_id field in Oracle database(character field of 20 byte length) . Claim_id was numericin the source data and i used put statement to convert into character with length & format of 20 bytes.

 

FINAL dataset is looking fine (7 byte claimid ), but ORacle load has shrinked to 5 byte. what i am missing?

 

PROC SQL;
                 create table FINAL as
          select a.*,
                     put(CLM_ID ,22.) as CLM_ID1  format = $20. ,

;

quit;

 

Thanks,

Ana

 


Accepted Solutions
Solution
‎02-26-2018 10:51 PM
Super User
Posts: 2,519

Re: Viewing SAS catalog entries and formats within SAS Enterprise Guide

I don't understand what you are doing.

 

In any case, in case this helps:

 

1. SAS can only store 16-digit integers (on PC/unix) before losing precision and distorting the values, when using numeric variables

   so put(CLM_ID ,22.)  is bound to produce bad results if you have that many digits.

   You should never use numeric variables for such a long series of digits.

 

2. If you have that many digits or more always use a string

 

3. If you have large integers stored as numeric variables, always use a length of 8 bytes for that variable

 

View solution in original post


All Replies
Solution
‎02-26-2018 10:51 PM
Super User
Posts: 2,519

Re: Viewing SAS catalog entries and formats within SAS Enterprise Guide

I don't understand what you are doing.

 

In any case, in case this helps:

 

1. SAS can only store 16-digit integers (on PC/unix) before losing precision and distorting the values, when using numeric variables

   so put(CLM_ID ,22.)  is bound to produce bad results if you have that many digits.

   You should never use numeric variables for such a long series of digits.

 

2. If you have that many digits or more always use a string

 

3. If you have large integers stored as numeric variables, always use a length of 8 bytes for that variable

 

Frequent Contributor
Posts: 126

Re: Viewing SAS catalog entries and formats within SAS Enterprise Guide

Thanks for the help. I changed it to 8 byte and it worked fine loading the data to Oracle tables.

Thanks again,
Ana
Super User
Posts: 2,519

Re: Viewing SAS catalog entries and formats within SAS Enterprise Guide

The title has no link whatsoever with the question asked.

☑ This topic is solved.

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

Discussion stats
  • 3 replies
  • 160 views
  • 0 likes
  • 2 in conversation