BookmarkSubscribeRSS Feed
ojoseph
Calcite | Level 5
1    data credit;
2    input x1-x20;
3    x1 = checking x2 = duration  x3 = history x4 = purpose x5 = amount x6 = savings  x7 = employ x8 = rate  x9 = status
                   --             --           --           --          --
                   22             22           22           22          22
3    x1 = checking x2 = duration  x3 = history x4 = purpose x5 = amount x6 = savings  x7 = employ x8 = rate  x9 = status
                                                                                      --
                                                                                      22
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, (, *, **, +, -, /, ;, <, <=, <>, =, >, ><, >=, AND, EQ, GE,
              GT, IN, LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR, [, ^=, {, |, ||, ~=.
11 REPLIES 11
art297
Opal | Level 21

What are you trying to accomplish? Hard to tell from the code you posted.

 

Art, CEO, AnalystFinder.com

ojoseph
Calcite | Level 5

i am using proc discim and proc factors to compute german credit datasets.

art297
Opal | Level 21

I'll restate my question: what were you trying to accomplish with the code you posted? e.g. I was trying to create a dataset called ZZ that had X records, each with Y variables, that contained the following values: xxx, yyy, zzz

 

Art, CEO, AnalystFinder.com

ojoseph
Calcite | Level 5

i was trying to work on datasets called german credit. it contains 20 x - variables and y response variable called good_bad. my sas procedure are proc discrim and proc factors.

Kurt_Bremser
Super User

Sorry, but in the code you posted there is not the faintest trace of these procedures. Your code just contains a syntactically wrong datastep, the purpose of which is not clear at all.


@ojoseph wrote:

i was trying to work on datasets called german credit. it contains 20 x - variables and y response variable called good_bad. my sas procedure are proc discrim and proc factors.


So, are you trying to manipulate data that is already present in a SAS dataset, or are you trying to read external (non-SAS) data into a dataset for further processing?

ojoseph
Calcite | Level 5
tying to manipulate external data into a dataset for further processing.
Reeza
Super User

Please seep the following links for video tutorials for basic tasks, and the free programming course. 

 

If you're not a programmer consider using the tasks. 

 

Support.sas.com/training/tutorial

Kurt_Bremser
Super User

It is also very important to know your environment. Are you using SAS University Edition, or a licensed SAS installation? If it is the latter, is it single machine, or client/server? And which operating system(s) is/are involved?

Tom
Super User Tom
Super User

If you just want to make your output easier to read then perhaps you just need to add a LABEL statement to your PROC call?

proc discrim data=german_credit;
  var x1-x20 ;
  label x1='Checking' x2='Duration' .... ;
run;
Kurt_Bremser
Super User

I see an input statement, but I see nothing that could provide data for the input (infile or cards/datalines).

Then I see several assignments to variables that were just used in the input statement, but those assignment statements are not properly separated by semicolons, and cause a syntax error message. So I have to repeat @art297's question: what are you trying to do in this data step? (Hint: your first answer to his question was not helpful at all)

Tom
Super User Tom
Super User

What format is your source data? Is it a text file, like a CSV or other delimited file?

Looks like you might be trying to read variables using dummy names like X1,X2 etc and then rename to to more meaningful names.

If you want to rename the use the RENAME statement (or dataset option).

rename
  x1 = checking
  x2 = duration
  x3 = history
  x4 = purpose
  x5 = amount
  x6 = savings
  x7 = employ
  x8 = rate
  x9 = status
;

Or better just read the variable using the names you want to begin with.

data want ;
  infile 'myfile.csv' dsd truncover firstobs=2;
  input checking duration history purpose amount savings
        employ rate status
  ;
run;

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