BookmarkSubscribeRSS Feed
Swati24
Obsidian | Level 7

We have created a date parameter in SAS DI and it is not getting resolved. I tried using date constant and input("&date",ddmmyy10.) as well but not getting any solution. Also for the reference attached the screenshot.

9 REPLIES 9
DMoovendhan
Quartz | Level 8

Hi,

 

It looks like the parameter is not been initialized or assigned a value.

If you are sure that the parameter is been assigned, please try 

 

%put &date;

 

This will give you the date value assigned to the parameter in the log window.

If its not resolving or you still getting the same error as in the screen shot that you presented then you would have to assign the value first.

 

Regards,

Moovendhan D

Swati24
Obsidian | Level 7

The values are getting assigned.

DMoovendhan
Quartz | Level 8
can you share the complete code, along with the execution log.
Swati24
Obsidian | Level 7




SAS Log
1 The SAS System Monday 3 December 2018 05:46:00 PM

NOTE: Copyright (c) 2016 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.4 (TS1M5 MBCS3170)
Licensed to INSPIRA ENTERPRISE INDIA PVT LTD-EVAL, Site 70241916.
NOTE: This session is executing on the X64_SR12R2 platform.



NOTE: Additional host information:

X64_SR12R2 WIN 6.3.9600 Server

NOTE: SAS Initialization used (Total process time):
real time 0.20 seconds
cpu time 0.03 seconds

NOTE: The autoexec file, C:\SAS\Config\Lev1\SASApp\StoredProcessServer\autoexec.sas, was executed at server initialization.

>>> SAS Macro Variables:

DATE=12Feb2018
DATE_LABEL=February 12, 2018 (February 12, 2018)
DISTRICT=
SYSDBMSG=ODBC: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user ''.
SYSDBRC=28000
TICKET=ST-8684-SwOfNaaDSye3JSGcqVBU-cas
TYPE=
UNIT=
_APSLIST=date,date_label,District,Type,Unit,_srvname,_rmthost,_htcook,_username,_srvport,_reqmeth,_debug,_htua,_grafloc,_version,ticket,_url,_rmtaddr,_reqencoding,_userlocale,_program,_encoding,
_result,_metaperson,_metauser,_metafolder,_client,_SECUREUSERNAME
_CLIENT=StoredProcessService 9.4; JVM 1.7.0_181; Windows Server 2012 R2 (amd64) 6.3
_DEBUG=131
_ENCODING=UTF-8
_GRAFLOC=/sasweb/graph
_HTCOOK=8dc70cc4d076c9cbf20ed27554256c4a_Cluster1=658E93E061B62DEC5D334B2C49BEA223.8dc70cc4d076c9cbf20ed27554256c4a_SASServer1_1
_HTUA=Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko
_METAFOLDER=/Karnataka Police/Jobs/
_METAPERSON=sasdemo
_METAUSER=sasdemo@WIN-5LB1E1GE2QI
_PROGRAM=/Karnataka Police/Jobs/Test_SP
_REPLAY="&_URL?_sessionid=C442A6B1-1D29-4151-BE2D-72614C803D33&_program=replay&_entry=&_TMPCAT.."
_REQENCODING=UTF-8
_REQMETH=GET
_RESULT=STATUS
_RMTADDR=10.7.9.149
_RMTHOST=10.7.9.149
_SECUREUSERNAME=sasdemo
_SRVNAME=phqanalytics.karnataka.gov.in
_SRVPORT=7980
_TMPCAT=APSWORK.TCAT0027
_URL=/SASStoredProcess/do
_USERLOCALE=en_US
_USERNAME=sasdemo
_VERSION=Version 9.4 (Build 520)

NOTE: %INCLUDE (level 1) file C:\SAS\SASHome\SASFoundation\9.4\inttech\sample\Process.sas is file C:\SAS\SASHome\SASFoundation\9.4\inttech\sample\Process.sas.
3 +*ProcessBody;
4 +%stpbegin;
5 +/****************************************************************************
6 + * Job: Process A5HJGUS2.BS0003UZ *
7 + * Description: *
8 + * *
9 + * Metadata Server: phqanalytics.karnataka.gov.in *
10 + * Port: 8561 *
11 + * Location: /Karnataka Police/Jobs *
12 + * *
13 + * Server: SASApp A5HJGUS2.AT000002 *
14 + * *
15 + * Source Table: FORT_SEMI - fort.FORT_SEMI A5HJGUS2.BK0004O1 *
16 + * *
17 + * Generated on: Monday, 3 December, 2018 5:44:54 PM IST *
18 + * Generated by: sasdemo@WIN-5LB1E1GE2QI *
19 + * Version: SAS Data Integration Studio 4.903 *
20 + ****************************************************************************/
21 +
22 +/* Generate the process id for job */
23 +%put Process ID: &SYSJOBID;
Process ID: 22952
24 +
25 +/* General macro variables */
26 +%let jobID = %quote(A5HJGUS2.BS0003UZ);
27 +%let etls_jobName = %nrquote(Process);
The SAS System

28 +%let etls_userID = %nrquote(sasdemo@WIN-5LB1E1GE2QI);
29 +
30 +/* Setup to capture return codes */
31 +%global job_rc trans_rc sqlrc;
32 +%let sysrc=0;
33 +%let job_rc = 0;
34 +%let trans_rc = 0;
35 +%let sqlrc = 0;
36 +%global etls_stepStartTime;
37 +/* initialize syserr to 0 */
38 +data _null_; run;

NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds


39 +
40 +%macro rcSet(error);
41 + %if (&error gt &trans_rc) %then
42 + %let trans_rc = &error;
43 + %if (&error gt &job_rc) %then
44 + %let job_rc = &error;
45 +%mend rcSet;
46 +
47 +%macro rcSetDS(error);
48 + if &error gt input(symget('trans_rc'),12.) then
49 + call symput('trans_rc',trim(left(put(&error,12.))));
50 + if &error gt input(symget('job_rc'),12.) then
51 + call symput('job_rc',trim(left(put(&error,12.))));
52 +%mend rcSetDS;
53 +
54 +/* Create metadata macro variables */
55 +%let IOMServer = %nrquote(SASApp);
56 +%let metaPort = %nrquote(8561);
57 +%let metaServer = %nrquote(phqanalytics.karnataka.gov.in);
58 +
59 +/* Setup for capturing job status */
The SAS System

60 +%let etls_startTime = %sysfunc(datetime(),datetime.);
61 +%let etls_recordsBefore = 0;
62 +%let etls_recordsAfter = 0;
63 +%let etls_lib = 0;
64 +%let etls_table = 0;
65 +
66 +%global etls_debug;
67 +%macro etls_setDebug;
68 + %if %str(&etls_debug) ne 0 %then
69 + OPTIONS MPRINT%str(;);
70 +%mend;
71 +%etls_setDebug;
72 +
73 +/*---- Start of User Written Code ----*/
74 +
75 +
76 +%put &date.;
12Feb2018
77 +/*---- End of User Written Code ----*/
78 +
79 +%let etls_endTime = %sysfunc(datetime(),datetime.);
80 +
81 +
82 +%stpend;
MPRINT(STPEND): options nonotes;
MPRINT(STPEND): ods _ALL_ close;
MPRINT(STPEND): options NOTES;
NOTE: %INCLUDE (level 1) ending.
Swati24
Obsidian | Level 7

The value for date is getting assigned. We are trying to pass this parameter in where tab for a variable which DI is selecting type as numeric but I'm providing the format for date.

DMoovendhan
Quartz | Level 8
Date values are numeric in SAS. If you want to filter a character date variable then you will have to assign the same format character value to the macro parameter.

To further investigate if you can share the macro and the parameter supplied along with sample data, that would help.
Swati24
Obsidian | Level 7
data one;
input UID Action: $10. Date: Date9.;
format date date9.;
datalines;
101 Pending 05Jan2011
102 Executed 09Jan2011
103 Executed 16Jan2011
104 Failed 15Feb2011
105 Warning 29Feb2012
106 Executed 1Mar2012
107 Executed 10Mar2012
108 Executed 17Mar2013
109 Pending 30Apr2013
110 Failed 18Sep2014
111 Failed 26Nov2014
112 Warning 15Aug2015
113 Pending 31Dec2018
;
run;
This is my sample data set and I want to pass the date prompts to subset the data in SAS DI.
DMoovendhan
Quartz | Level 8

you are reading the date from data lines using date9. date format, so the data value will be read with that format and will be a numeric value. Format that you applied the nest statement is for the appearance and to ease the interpretation of data.

 

When you supply the parameter, you supply it as a neumeric date or you can read the date as character and supply the parameter as character date.

 

Which ever is convenient for you.

Swati24
Obsidian | Level 7
If I will create date parameter as character then I will not be able to use this prompt for manipulation as I have to create a report for fortnight count for the Action.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 9 replies
  • 1738 views
  • 0 likes
  • 2 in conversation