BookmarkSubscribeRSS Feed
R_Chung
Quartz | Level 8

Hi everyone.

 

This time, I would like to use loop transformation to pass a date9. value to another job.

1.jpg

 

 

 

 

 

 

 

 

In the picture,1.jpg

 

 

 

date_from and date_to are date 9. format.

 

As I know, all date format are regarded as integer.

Therefore, when I set the parameter (date_from) in another job. it is also integer.

when I type %put &date_from, it gives me 20636, which is not 01JUL2016.

 

So what can I set to get back the value with date9. format.

i.e,  %put &date_from --> 01JUL2016

 

 

Thanks

5 REPLIES 5
LinusH
Tourmaline | Level 20

Well, 20636 is actually 01Jul 2016. It's just not formatted.

What does the logic look like that will act on this parameter?

A where-clause?

Data never sleeps
R_Chung
Quartz | Level 8
It is the same date9.
Chines
Calcite | Level 5
I would recommend that, in a transformation before the Loop, you convert the numeric fields to character fields, and map those character fields to the parameters in the Loop.

e.g.

Name: date_from_char
Expression: put(date_from, date9.)
Format: $9.
Length: 9
R_Chung
Quartz | Level 8

I have changed to character format but error obtained after entering the loop transformation

ERROR: Invalid date/time/datetime constant "20636"d.

 

Below is before entering the loop transformation:

 

 

1.jpg

 If I change back to numeric type1.jpg

 

 

It becomes normal

1.jpg

 

 

 

 

R_Chung
Quartz | Level 8
I solve it by adding following code in the loop transformation:


data _null_;
call symputx('date_from', put(&date_from, date9.));
run;

reference:
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000195834.htm

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1713 views
  • 1 like
  • 3 in conversation