hello,
Do you know how to fill value with zero and reach a tens digit?
for table have
have |
CIK |
915913 |
1029506 |
3673 |
75677 |
0001091530 |
I expect to get table want
want |
CIK |
0000915913 |
0001029506 |
0000003673 |
0000075677 |
0001091530 |
thanks in davance.
data table1; infile cards truncover; input CIK $100. ; cards; 915913 1029506 3673 75677 0001091530 ;
Use the Z. format.
cik = put( input(cik, 10.), z10.) ;
Use the Z. format.
cik = put( input(cik, 10.), z10.) ;
@Alexxxxxxx wrote:
hello,
Do you know how to fill value with zero and reach a tens digit?
for table have
have CIK 915913 1029506 3673 75677 0001091530 I expect to get table want
want CIK 0000915913 0001029506 0000003673 0000075677 0001091530
thanks in davance.
data table1; infile cards truncover; input CIK $100. ; cards; 915913 1029506 3673 75677 0001091530 ;
You have just shown why CIK (central index key from the SEC I presume) should always be treated a a character variable.
Try this (I replaced your $100. with $10.):
data table1;
infile cards truncover;
input cik $10.
cik=translate(right(cik),'0',' ');
cards;
915913
1029506
3673
75677
0001091530
;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.