BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
adilar39
Obsidian | Level 7

Hello everyone, I would like to ask a question.

 

options cashost="xxxx" casport=5570;
/*caslib _all_ assign;*/
/* option validvarname=any; */
libname satpp cas caslib="satpp";

FILENAME request HTTP
'api link'
user='user' password='password' debug;
DATA NULL;
INFILE request;
INPUT;
PUT INFILE;
RUN;
libname sadarPP JSON fileref=request;

data work.satpp_sadarPP;
	set sadarPP.root;
run;

proc sql;
	create table work.satpp_sadarL as
		select ID_responses,
Sent_date,
Name,
Age,
Gender
		from work.satpp_sadarPP;
quit;

/*change data format*/
data work.satpp_sadarL;
set work.satpp_sadarL;
time=input(Sent_date,ANYDTDTM.);
format time datetime19.;
run;

/* sorting data by date */
proc sort data=work.satpp_sadarL;
	by time;
run; 

%macro checktable(dsn);
%if %sysfunc(exist(&dsn)) %then %do;
    proc delete data=&dsn; run;
%end;
%mend;

%checktable(work.satpp_sadarL)

data satpol.final (promote=yes);
set work.satpp_sadarL;
run;

I have code like above, that get JSON data from API link to be inputted in library. I want that library to be promoted to Data Source that can be used in SAS Visual Analytics, and scheduled a job so that it always updated everytime there's a new data inputted in that API.

It used to be working just fine, but now there's error like this.

ErrorError

This is what my libraries look like

My LibraryMy Library

Is there any change to SAS or my code that's wrong?
Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
adilar39
Obsidian | Level 7

I already found the solution. There's something wrong with my code, and then the error shown up change to "Caslib does not exist in this session". After Caslib made, the code works just fine.
Thanks.

In case anyone want to see the fixed code, here it is:

options cashost="xxxx" casport=5570;
/*caslib _all_ assign;*/
/* option validvarname=any; */
libname satpp cas caslib="satpp";

FILENAME request HTTP
'api link'
user='user' password='password' debug;
DATA NULL;
INFILE request;
INPUT;
PUT INFILE;
RUN;
libname sadarPP JSON fileref=request;

data work.satpp_sadarPP;
	set sadarPP.root;
run;

proc sql;
	create table work.satpp_sadarL as
		select ID_responses,
Sent_date,
Name,
Age,
Gender
		from work.satpp_sadarPP;
quit;

/*change data format*/
data work.satpp_sadarL;
set work.satpp_sadarL;
time=input(Sent_date,ANYDTDTM.);
format time datetime19.;
run;

/* sorting data by date */
proc sort data=work.satpp_sadarL;
	by time;
run; 

%macro checktable(dsn);
%if %sysfunc(exist(&dsn)) %then %do;
    proc delete data=&dsn; run;
%end;
%mend;

%checktable(satpp.final)

data satpp.final (promote=yes);
set work.satpp_sadarL;
run;

View solution in original post

2 REPLIES 2
SASKiwi
PROC Star

AFAIK, PROC CASUTIL is the way to promote a SAS dataset to a CAS library to be used in Viya VA.

adilar39
Obsidian | Level 7

I already found the solution. There's something wrong with my code, and then the error shown up change to "Caslib does not exist in this session". After Caslib made, the code works just fine.
Thanks.

In case anyone want to see the fixed code, here it is:

options cashost="xxxx" casport=5570;
/*caslib _all_ assign;*/
/* option validvarname=any; */
libname satpp cas caslib="satpp";

FILENAME request HTTP
'api link'
user='user' password='password' debug;
DATA NULL;
INFILE request;
INPUT;
PUT INFILE;
RUN;
libname sadarPP JSON fileref=request;

data work.satpp_sadarPP;
	set sadarPP.root;
run;

proc sql;
	create table work.satpp_sadarL as
		select ID_responses,
Sent_date,
Name,
Age,
Gender
		from work.satpp_sadarPP;
quit;

/*change data format*/
data work.satpp_sadarL;
set work.satpp_sadarL;
time=input(Sent_date,ANYDTDTM.);
format time datetime19.;
run;

/* sorting data by date */
proc sort data=work.satpp_sadarL;
	by time;
run; 

%macro checktable(dsn);
%if %sysfunc(exist(&dsn)) %then %do;
    proc delete data=&dsn; run;
%end;
%mend;

%checktable(satpp.final)

data satpp.final (promote=yes);
set work.satpp_sadarL;
run;

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 331 views
  • 0 likes
  • 2 in conversation