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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.