BookmarkSubscribeRSS Feed
flh3
Fluorite | Level 6

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.

12 REPLIES 12
jakarman
Barite | Level 11

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).

---->-- ja karman --<-----
Patrick
Opal | Level 21

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).

flh3
Fluorite | Level 6

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.

JohnMart
Calcite | Level 5

I have the same problem.

Programs that run with no problem with SAS 9.1 do not run except with errors in SAS edition.

 

 

Reeza
Super User

I get the same errors in SAS 9.3 from copying and pasting the text you have above.

EDITED

Cynthia_sas
SAS Super FREQ

Hi: Your code also failed for me in SAS 9.4, as written.

cynthia

flh3
Fluorite | Level 6

That's odd, the syntax copied and pasted into this text box disregarded the spaces:

My original syntax in SAS looks like:

ScreenHunter_53 Aug. 03 07.44.jpg

When I run it, results in:

ScreenHunter_54 Aug. 03 07.47.jpg

To test out SAS U, I copied and pasted the original SAS syntax into SAS U (still looks correct):

ScreenHunter_55 Aug. 03 07.48.jpg

However, results in this:

ScreenHunter_56 Aug. 03 07.49.jpg

jakarman
Barite | Level 11

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       

---->-- ja karman --<-----
data_null__
Jade | Level 19

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.

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


flh3
Fluorite | Level 6

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!

amrit11
Obsidian | Level 7

use ctrl-x to copy a "tab" and use replace (ctrl-H) to replace it with a space. The resulting code WORKS !!!

grace_sas
SAS Employee

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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 12 replies
  • 4910 views
  • 4 likes
  • 9 in conversation