I am using the following two lines to get beginning and end dates needed for an api request. I have another api request where the time must be included as well. It looks like "2018-04-01T00:00:00-07:00" I do not understand -07:00 at all. But this is what I need.
Is there a time format I can use to get this or a way to "text" it in after the date entry in the url string?
filename criteo '/opt/sas/data/sasuser/sn161735/criteo.json';
data test;
enddate=today()-1;
begindate=intnx('qtr',enddate,0,'b');
token='xx';
length url $300 ;
url=quote(cats('https://publishers.criteo.com/api/2.0/stats.json?apitoken=',token
,'&begindate=',put(begindate,yymmddd10.)
,'&enddate=',put(enddate,yymmddd10.)
,'&metrics=Date;TotalImpression;CPM;Revenue;WinRate'
),"'");
call symputx('url',url);
call symputx('webusername',quote("x"rk));
call symputx('webpassword',quote("x"));
run;
proc http url=&url method="GET" out=criteo
webusername=&webusername
webpassword=&webpassword
AUTH_BASIC
;
run;
libname criteo json fileref=criteo;
PROC SQL;
CREATE TABLE CRITEO_DATA AS
SELECT t1.date,
t1.totalImpression FORMAT=COMMA9. AS totalImpression,
t2.value FORMAT=DOLLAR9.2 AS Revenue,
t3.value FORMAT=DOLLAR6.2 AS CPM
FROM CRITEO.ROOT t1, CRITEO.REVENUE t2, CRITEO.CPM t3
WHERE (t1.ordinal_root = t2.ordinal_root AND t1.ordinal_root = t3.ordinal_root);
QUIT;
That looks like the E8601DX. format. The last bit, -07:00 is your timezone offset.
That looks like the E8601DX. format. The last bit, -07:00 is your timezone offset.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.