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

Hi, 

I have large data stored in Oracle where multiple variables are set up as varchar2(4000 byte).

Some of them are in fact numbers but are stored with a +, and a bunch of leading zeros.  In the example (in the table attached there is an example of what I have) the number start with the first non zero value and it is to be divided by 100000.

I need only a relatively small subset of data in sas, obtained through joining another oracle table.

how do I get the data in SAS already converted into number so that they do not occupy su much space?

thank you very much in advance

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Posting datasets in data step code makes helping yopu much easier. This is the code that was created by the macro mentioned in my footnotes:

data HAVE;
  infile datalines dsd truncover;
  input a:$4000.;
datalines4;
+00000005609333000
+00000002399300000

+00000002477900000
+00000000026800000

+00000000770400000
+00000002178300000
+00000001558100000
+00000001694400000
;;;;
run;

Run this code against this dataset:

data want;
set have;
b = input(a,18.5);
format b 18.5;
keep b;
run;

proc print data=want noobs;
run;

Result:

          b

56093.33000
23993.00000
     .     
24779.00000
  268.00000
     .     
 7704.00000
21783.00000
15581.00000
16944.00000

View solution in original post

1 REPLY 1
Kurt_Bremser
Super User

Posting datasets in data step code makes helping yopu much easier. This is the code that was created by the macro mentioned in my footnotes:

data HAVE;
  infile datalines dsd truncover;
  input a:$4000.;
datalines4;
+00000005609333000
+00000002399300000

+00000002477900000
+00000000026800000

+00000000770400000
+00000002178300000
+00000001558100000
+00000001694400000
;;;;
run;

Run this code against this dataset:

data want;
set have;
b = input(a,18.5);
format b 18.5;
keep b;
run;

proc print data=want noobs;
run;

Result:

          b

56093.33000
23993.00000
     .     
24779.00000
  268.00000
     .     
 7704.00000
21783.00000
15581.00000
16944.00000

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 713 views
  • 0 likes
  • 2 in conversation