BookmarkSubscribeRSS Feed
maddepusrikanth
Calcite | Level 5

Hi All,

 

Here is my code please review.

CODA = (Strip (190000 +substr(CODA,2,6)); /* OP Values are correct*/

coda21=Strip(Put(coda2,$6); /* OP Values are correct*/

ADCB=MDY(SUBSTR(CODA21,5,2),SUBSTR(CODA21,7,2),SUBSTR(CODA21,1,4); /* OP Values are null*/

I want only month and year in ADCB.

Please advice.

Thanks.

 

7 REPLIES 7
sbxkoenk
SAS Super FREQ

Hello,

 

coda21 has only 6 characters / positions due to :

 

coda21=Strip(Put(coda2,$6);

 

So, the second argument of your MDY function to define ADCB cannot be correct :

SUBSTR(CODA21,7,2)

Cheers,

Koen

Kurt_Bremser
Super User
CODA = (Strip (190000 +substr(CODA,2,6)); /* OP Values are correct*/

????

+ is a numeric operator, SUBSTR returns a character value, and STRIP expects a character value as input, so you have two conversions happening before the result is stored in CODA.

Similarly, MDY expects numeric input values, and you feed it character.

What is the type of CODA (numeric or character), and what raw (unformatted!) values are stored in it?

maddepusrikanth
Calcite | Level 5

Hi,

 

we are migrating SAS base to SAS DLH.

the below code is in SAS base.

SAS BASE

Data RACCPERF.BDAXPCARDP_&str_tgl_1;

SET &lib.xxxxxxxxx (keep= CRDNBR CRDACCT CRDUSRDTA CRDEMBL3 CRDBLK CRDBLKDTE CRDPDTNBR CRDEXPDTE CRDSTATUS CRDEMBL1 CRDRLNSHP) ;

UCRDBLKDTE = INPUT(INput(STRIP(CRDBLKDTE),$8.),YYMMDD8.);

coba = strip('1000000' + put(strip(crdexpdte),$4.));
if substr(coba,4,2) in ('00','01','02','03','04','05','06','07','08','09','10','11','12','13',
'14','15','16','17','18','19') then do;
coba2 = strip('200000' + substr(coba,2,6));
end;
else do;
coba2 = strip('190000' + substr(coba,2,6));
end;

UCRDEXPDTE = INPUT(INPUT(COBA2,$6.),YYMMN6.);

as_of_date=strip(put(&str_tgl_1,$14.));

run;

 

SAS DLH Code.

WhatsApp Image 2021-11-29 at 07.11.00.jpeg

 

Plz Advice.

Thanks.

 

 

 

sbxkoenk
SAS Super FREQ

Hello,

 

I am also wondering about the answer to the question of @Kurt_Bremser !

 

Further,

are you talking about SAS Data Loader for Hadoop (DLH)?

 

You should know that SAS is a big software package with lots of products and solutions and modules.
Using abbreviations in a board (with a topic as general as "SAS VIYA") may make people confused on where you are exactly in the SAS software.

 

Thanks,

Koen

maddepusrikanth
Calcite | Level 5

are you talking about SAS Data Loader for Hadoop (DLH)?

Yes, SAS to SASDLH Migration.

 

Kurt_Bremser
Super User

Your issue is that you start with crap.

Bogus code like this

coba = strip('1000000' + put(strip(crdexpdte),$4.));

which causes several type conversions in one statement is at best extremely sloppy, done by someone without a clue. Fix such things first before thinking about migrating.

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!

Discussion stats
  • 7 replies
  • 1111 views
  • 0 likes
  • 3 in conversation