I am comparing standard SAS syntax and testing it with SAS University (for students to use).
I have basic syntax to create a small fictional 'class' dataset:
data class;
input name $20. gradeM $ scoreM gradeR $ scoreR e1 e2 e3 testdate mmddyy10.;
cards;
Allen, Jeremy B 90 B 75 5 4 2 10/15/2009
Barret, Linda A+ 96 C+ 85 2 2 4 11/20/2009
Cizek, Lucas A+ 94 B 80 3 3 2 9/20/2009
Smith, Alice C 80 A 97 4 5 1 9/1/2009
Cordova, Edwin D 75 F 60 3 5 2 8/30/2009
;
run;
This works fine when I run it within SAS and it creates a class dataset as expected. When I try to use it with SAS U (just copying and pasting the same syntax), I get the errors below. Why should this work any differently? Now I am worried about introducing SAS U to students.
OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
42 ;
43
44 data class;
45 input name $20. gradeM $ scoreM gradeR $ scoreR e1 e2 e3 testdate mmddyy10.;
46 cards;
NOTE: Invalid data for e1 in line 47 34-43.
NOTE: Invalid data for e2 in line 48 1-7.
NOTE: Invalid data for e3 in line 48 9-13.
NOTE: Invalid data for testdate in line 48 15-24.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
48 CHAR Barret, Linda ...A+ .96.C+.85 2 2 4 11/20/2009.
ZONE 46776722466662000422033042033232323233233233330222222222222222222222222222222222
NUMR 212254C0C9E4109991B099693B985020204011F20F20099000000000000000000000000000000000
NOTE: Invalid data errors for file CARDS occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
name=Allen, Jeremy B 9 gradeM=0 B 75 scoreM=5 gradeR=4 scoreR=2 e1=. e2=. e3=. testdate=. _ERROR_=1 _N_=1
NOTE: Invalid data for e1 in line 49 34-43.
NOTE: Invalid data for e2 in line 50 1-6.
NOTE: Invalid data for e3 in line 50 8-21.
NOTE: Invalid data for testdate in line 50 23-32.
There is something wrong with your copy. In the printed zone line there are 0-'s.
It has been shifted but is seems to be the tab character. (09x) These are printed as . in the readable line above shown as space in your source. Do not use those kind of tab chars. This is not an issue of SAS but more not consistent definition of the tab-char.
Advice: expand them to real spaces (20x).
As to my knowledge the University Edition uses exactly the same code base than any other SAS implementation so the only thing you need to test is how to move your code and data to this environment (eg. changing path names, not distorting your data by moving them), if you're using SAS modules in your source environment which are not available in the University Edition and if the SAS versions are the same in source and target (I assume the University Edition is at least on the version level of your source environment and as SAS code is highly backward compatible there shouldn't be any issues there).
Only thing I did was copy and paste (nothing else). I've added screenshots in another message below. I use copy and paste to have students just use provided code so they don't have to type things in.
I have the same problem.
Programs that run with no problem with SAS 9.1 do not run except with errors in SAS edition.
I get the same errors in SAS 9.3 from copying and pasting the text you have above.
EDITED
Hi: Your code also failed for me in SAS 9.4, as written.
cynthia
That's odd, the syntax copied and pasted into this text box disregarded the spaces:
My original syntax in SAS looks like:
When I run it, results in:
To test out SAS U, I copied and pasted the original SAS syntax into SAS U (still looks correct):
However, results in this:
Yes, I already stated there is something strange with the spaces/tab (09x). You are only proofing that by telling what you are seeing.
What is realy there is NOT what you are seeing.
I reordered your code after having a copy/paste of that.
I have noticed issues arround the refreshing of screens and using cut/paste.
Below is the log of the code as it did run correctly.
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
42 ;
43 data class;
44 input name $20. gradeM $ scoreM gradeR $ scoreR e1 e2 e3 testdate mmddyy10.;
45 put _infile_ ;
46 cards;
Allen, Jeremy B 90 B 75 5 4 2 10/15/2009
Barret, Linda A+ 96 C+ 85 2 2 4 11/20/2009
Cizek, Lucas A+ 94 B 80 3 3 2 9/20/2009
Smith, Alice C 80 A 97 4 5 1 9/1/2009
Cordova, Edwin D 75 F 60 3 5 2 8/30/2009
NOTE: The data set WORK.CLASS has 5 observations and 9 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
52 ;
53 run;
54
This clearly shows there are tabs in the data lines. And that in some version of SAS they are being expanded by the editor and not in SAS/UE. I reckon adding INFILE CARDS EXPANDTABS; will fix it. Learning to read the HEX display below is important it "you" plan to read data from INFILE. While the below was generated by the invalidate error you can make this display with the LIST statement which can be helpful when exploring the contents of a file.
Thanks. Yes. That helps. I am more concerned with the differences of tabs vs. spaces in the SAS/UE (that results from just using copy and paste).
However, data_null_'s solution worked like a charm and is pretty straightforward! No need to retype anything. Just added:
infile cards expandtabs;
I didn't even know that there was an expandtabs option! Thanks!
use ctrl-x to copy a "tab" and use replace (ctrl-H) to replace it with a space. The resulting code WORKS !!!
This issue is explained in a SAS Note .
Although the SAS Note needs to be edited because the preference works before or after SAS Studio 3.6. So in the latest University Edition which uses SAS Studio 3.71, you can use the preference OR the delimiter method.
There was a regression in SAS Studio 3.6 so that only specifying the delimiter worked.
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.