Hello all,
I am using SAS Studio 5.1 (VIYA release V.03.04).
I am very new to VIYA programming and am trying to import a CSV file from my desktop into my CAS library so that I can manipulate it in SAS VIYA studio and then push it to SAS VIYA Visual Analytics. I know how to import it through Visual Analytics for use in Studio, but not the other way around.
At the moment, the only way I can figure out how to do this is to import a file manually using Explorer > Upload file.
However, this places the CSV in Explorer > SAS Content (rather than > Libraries), so I then have to use PROC IMPORT to import it from SAS Content into my CAS session and then use PROC CASUTIL to promote it for use throughout VIYA.
Also, I cannot for the life of me get Studio to recognise file paths, so have to manually point-and-click to create a file reference to do the PROC IMPORT. I've tried searching for help, but everything I have found so far seems to discuss how to move things from the libraries section into CAS, but everything I import is first stuck in SAS Content.
I'm sure it's something very obvious for someone in the know, but can anyone point me in the right direction or am I doomed forever?
I've included my hack job of the code below in case it helps. Thanks in advance!
/*MANUAL ACTION - need to create a file reference 'testing' by right-clicking on the file because can't seem to find the right file path*/
/** Import the CSV file from SAS content into the public cas session. **
PROC IMPORT DATAFILE=TESTING
OUT=pubcas.MYCSV
DBMS=CSV
REPLACE;
RUN;
/** Unassign the file reference. **/
FILENAME testing;
/** Print the results. **/
PROC PRINT DATA=pubcas.MYCSV;
RUN;
/*IT SUPPORT Q - Why can it print the table but I can't open it and see it through drag and drop?*/
/*Checking the Promoted Table to see if the mycsv table is global_promoted It isn't*/
proc casutil;
list tables incaslib="public";
run;
/*Because it's not promoted - I need to promote it*/
proc casutil;
promote casdata="MYCSV"
Incaslib="PUBLIC" Outcaslib="PUBLIC" CASOUT="MYCSV";
run;
/*Rechecking to see if the Promoted Table to see if the mycsv table is global/promoted - It is.*/
proc casutil;
list tables incaslib="PUBLIC";
run;
/*Should now be accessible through Explore and Visualise Data (can sometimes take a few minutes)*/
Sorry I don't know enough to give an in-depth response but there are two ways to do that and first you already found. The other way is in this article.
In most environments i know accessing a users desktop via code is not possible, because it would require that the server executing the sas-code has access to the computer.
Sorry I don't know enough to give an in-depth response but there are two ways to do that and first you already found. The other way is in this article.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.