I ran the following code to import my data and it ran fine:
DATA CSD.DEV CSD.VAL;
SET CSD.BITS;
IF RANUNI (1000)<= 0.7 THEN OUTPUT CSD.DEV;
ELSE OUTPUT CSD.VAL;
RUN;
@MeghnaRoy9 wrote:
I ran the following code to import my data and it ran fine:
PROC IMPORT DATAFILE="/folders/myfolders/SAS Assignment/Cross Sell_Data.csv"OUT=CSDDBMS=CSVREPLACE;RUN;Post this step I ran this code but just a blank file got created:Libname CSD "/folders/myfolders/SAS Assignment";run;
What is a "blank file"? Do you mean that there are no SAS data sets in the folder /folders/myfolders/SAS Assignment? That would be the expected result. THe only thing that a LIBNAME statement does is that it tells SAS to look in the specified folder for SAS data sets, and if there are no SAS data sets in there, it shows that fact. (Also, you don't need a RUN; statement after a LIBNAME statement)
Perhaps this is what you want? Note the change of order, and the referring to the imported data set by CSD.cross_sell_data, the name beginning with CSD and a period indicating that this data set is to reside in the SAS library named CSD, which was defined by the LIBNAME statement.
libname csd "/folders/myfolder/SAS assignment";
PROC IMPORT DATAFILE="/folders/myfolders/SAS Assignment/Cross Sell_Data.csv"
OUT=CSD.cross_sell_data
DBMS=CSV
REPLACE;
RUN;
Also, please go back to your original post and give a meaningful title to your question, such as "LIBNAME and PROC IMPORT problem".
If you do not have a file called
bits.sas7bdat
in your directory
/folders/myfolders/SAS Assignment
Then you won't have a dataset
CSD.BITS
I see no code that would have created this dataset, either.
@MeghnaRoy9 wrote:
I ran the following code to import my data and it ran fine:
PROC IMPORT DATAFILE="/folders/myfolders/SAS Assignment/Cross Sell_Data.csv"OUT=CSDDBMS=CSVREPLACE;RUN;Post this step I ran this code but just a blank file got created:Libname CSD "/folders/myfolders/SAS Assignment";run;
What is a "blank file"? Do you mean that there are no SAS data sets in the folder /folders/myfolders/SAS Assignment? That would be the expected result. THe only thing that a LIBNAME statement does is that it tells SAS to look in the specified folder for SAS data sets, and if there are no SAS data sets in there, it shows that fact. (Also, you don't need a RUN; statement after a LIBNAME statement)
Perhaps this is what you want? Note the change of order, and the referring to the imported data set by CSD.cross_sell_data, the name beginning with CSD and a period indicating that this data set is to reside in the SAS library named CSD, which was defined by the LIBNAME statement.
libname csd "/folders/myfolder/SAS assignment";
PROC IMPORT DATAFILE="/folders/myfolders/SAS Assignment/Cross Sell_Data.csv"
OUT=CSD.cross_sell_data
DBMS=CSV
REPLACE;
RUN;
Also, please go back to your original post and give a meaningful title to your question, such as "LIBNAME and PROC IMPORT problem".
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.