- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello SAS community,
I am trying to import a csv file into SAS, but my code is not working. I followed all the basic instructions; I put the "path" at first in my coding then included the filename and “.csv” that is the file extension. Here is my code:
/*import data with low user control*/
proc import datafile='C:\Users\ftahsin\Desktop\Medicaid dissertation data\Raw data files\Mcaid_baby.csv'
out=work.Mcaid_baby
DBMS=csv
replace;
run;
The result in the log is as follows:
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future
SAS release. Inserting white space between a quoted string and the
succeeding identifier is recommended.
494 proc import datafile='C:\Users\ftahsin\Desktop\Medicaid dissertation data\Raw data
494! files\Mcaid_baby.csv'
495 out=work.Mcaid_baby
496 DBMS=csv
497 replace;
498 run;
Can someone please tell me what did I do wrong? Or is there a problem in my dataset that I need to fix before I run the code?
Thanks!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
That sort of note relates to any code where you have a quoted value and no space after the closing quote except for some very specific values and the reason why the not appears.
SAS has rules for telling the system some values are intended to be used in a particular manner.
If you have in a data step something like : x='01JAN2020' ; then x is character value. Adding D after the quote as in: x='01JAN2020'd ; makes X a SAS numeric date value. There are similar indicators for time and datetime values. Also if you are using the option VALIDVARNAME=ANY or VALIDMEMNAME=ANY then you can have variable or data set names that do not use the normal SAS variable and set name rules. But you still need to tell SAS that is how the string is used so you have a value like "Var with space"N where the N after the quote tells SAS the string is a name.
So the note is warning you that the particular code you used which runs in one way now might behave differently in the future if an addition "literal" type of value is added.
Please, anytime you have a question about a note, warning or error in the log include the entire data step or procedure from the log. Copy the text of the entire proc or data step and paste into a code box opened on this forum with the </> icon to preserve formatting.
The "note" you posted was incomplete because that note includes diagnostic characters that specifically tell where the issue occurs.
Example:
1899 data junk; 1900 q=23; 1901 put "Some variable after quote"q; --------------------------- 49 NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a quoted string and the succeeding identifier is recommended. 1902 run; Some variable after quote23 NOTE: The data set WORK.JUNK has 1 observations and 1 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.00 seconds
The row of underscores indicates the string value within the quotes and it is easy to see there is no space between the closing quote and the q. If instead of q the variable had been named n, d, t or dt we would get a different ERROR:
1911 data junk; 1912 n=23; 1913 put "Some variable after quote"n; ERROR: The name Some variable after quote is not a valid SAS name. 1914 run; NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set WORK.JUNK may be incomplete. When this step was stopped there were 0 observations and 1 variables. WARNING: Data set WORK.JUNK was not replaced because this step was stopped. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.00 seconds
The n in the Put was interpreted as indicating a name that is not valid because of the current setting of the VALIDVARNAME system option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What do you mean by "...but my code is not working"? - you haven't posted
any error message from the log.
What SAS platform do you use?
In case it is SAS University Edition - you can't use path like 'C:\....'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Never mind, I figured it out. It was a minor error in the name of my csv file.
Thanks for your reply.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
That sort of note relates to any code where you have a quoted value and no space after the closing quote except for some very specific values and the reason why the not appears.
SAS has rules for telling the system some values are intended to be used in a particular manner.
If you have in a data step something like : x='01JAN2020' ; then x is character value. Adding D after the quote as in: x='01JAN2020'd ; makes X a SAS numeric date value. There are similar indicators for time and datetime values. Also if you are using the option VALIDVARNAME=ANY or VALIDMEMNAME=ANY then you can have variable or data set names that do not use the normal SAS variable and set name rules. But you still need to tell SAS that is how the string is used so you have a value like "Var with space"N where the N after the quote tells SAS the string is a name.
So the note is warning you that the particular code you used which runs in one way now might behave differently in the future if an addition "literal" type of value is added.
Please, anytime you have a question about a note, warning or error in the log include the entire data step or procedure from the log. Copy the text of the entire proc or data step and paste into a code box opened on this forum with the </> icon to preserve formatting.
The "note" you posted was incomplete because that note includes diagnostic characters that specifically tell where the issue occurs.
Example:
1899 data junk; 1900 q=23; 1901 put "Some variable after quote"q; --------------------------- 49 NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a quoted string and the succeeding identifier is recommended. 1902 run; Some variable after quote23 NOTE: The data set WORK.JUNK has 1 observations and 1 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.00 seconds
The row of underscores indicates the string value within the quotes and it is easy to see there is no space between the closing quote and the q. If instead of q the variable had been named n, d, t or dt we would get a different ERROR:
1911 data junk; 1912 n=23; 1913 put "Some variable after quote"n; ERROR: The name Some variable after quote is not a valid SAS name. 1914 run; NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set WORK.JUNK may be incomplete. When this step was stopped there were 0 observations and 1 variables. WARNING: Data set WORK.JUNK was not replaced because this step was stopped. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.00 seconds
The n in the Put was interpreted as indicating a name that is not valid because of the current setting of the VALIDVARNAME system option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
ALWAYS post the complete log, including all statements to which the NOTEs, WARNINGs or ERRORs refer.
Use the </> button for posting logs. This keeps the horizontal formatting, which is essential for identifying erroneous code elements.