BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Tom
Super User Tom
Super User

You need to use an actual variable name in your code, not gibberish like this:

where POS Consumer Price=0

That code has three names POS, Consumer, and Price without any operators between them.

 

If you use PROC IMPORT with VALIDVARNAME option set to V7 then a COLUMN with a header of 'POS Consumer Price' will become a VARIABLE named POS_Consumer_Price.

 

So use

where POS_Consumer_Price=0

in the code.

 

If you accidentally ran the PROC IMPORT with VALIDVARNAME set to ALL then you will have to use a name literal in your code.

where 'POS Consumer Price'n=0

 

Tom
Super User Tom
Super User

Your file appears to be using a bare CR as the end of line marker.

NOTE: The infile CSV is:
      (system-specific pathname),
      (system-specific file attributes)

RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
1         Rest Owner,Rest Coop,REST_KEY,MITM_KEY,Menu Item,Menu Item Combo Meal Flag,Reporting Day,POS Consume
     101  r Price,POS Total Units Sold  Promo and Regular,POS Promotion Units Sold,POS Units Sold,POS Combo Un

     201  its Sold.SMITH JOE,SEA/TCA WA CP-0024,1364,1,00000001-REUBEN,N,1/1/11,0.95,25,0,25,6.SMITH JOE,SEA/T
    ZONE  6772566605445424442544254425424523333233332323333333325454442423232332323323323233230544542444254425
    NUMR  94303FC4D3D9480AF5C351F431071030D0024C1364C1C00000001D25525ECEC1F1F11C0E95C25C0C25C6D3D9480AF5C351F4

So make sure to tell SAS that before trying to use PROC IMPORT to GUESS how to read the file.

filename csv "C:\downloads\Product Sales_Candidate Attach 1_PresSE_013.csv" 
  termstr=cr
;
proc import file=csv dbms=csv out=want replace;
run;
NOTE: 6516 records were read from the infile (system-specific pathname).
      The minimum record length was 72.
      The maximum record length was 94.
NOTE: The data set WORK.WANT has 6516 observations and 12 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


6516 rows created in WORK.WANT from CSV.

Note that there is still a bug in Excel on a Mac where it does not understand that MacOS is now a flavor of Unix and it should use LF as the end of line marker.  If you want to convert a spreadsheet to a CSV file on a Mac make sure to select the right file format so that it makes a file that use LF or CRLF as the end of line marker.

BrahmanandaRao
Lapis Lazuli | Level 10
Thank your Tom
for your solution i enable in preferences validvarname=v7 option in sas on demand then it replaces uderscore in all variables for embadded blanks

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 20 replies
  • 2886 views
  • 1 like
  • 5 in conversation