Help using Base SAS procedures

Defining a autonumber ID column when creating a dataset?

Reply
Super Contributor
Posts: 400

Defining a autonumber ID column when creating a dataset?

Let me start off by saying that I'm very new to SAS so excuse me for any minor mistakes.

I'm trying to create a dataset that will have an ID column with autogenerated numbers as the ID's.
With this dataset how can I had an Id field as the first column?

data Person;
input fname $ lname $ city $;
datalines;
BOB JONES BOSTON
FRED SMITH MIAMI
;
run;

Thank You
Jerry
Valued Guide
Posts: 2,177

Re: Defining a autonumber ID column when creating a dataset?

Posted in reply to jerry898969
add a line just before the input statement[pre] ID+1 ;[/pre]
good Luck

PeterC
Super Contributor
Posts: 400

Re: Defining a autonumber ID column when creating a dataset?

Pete,
Thank you so much that was simple enough.

In my data lines what do I have to do to get New York as the city, it only shows New?

Thanks again
Jerry
Super Contributor
Posts: 400

Re: Defining a autonumber ID column when creating a dataset?

Posted in reply to jerry898969
Nevermind I figured it out $20. fixed it in the input statement.

Thanks again for the help
Jerry
Ask a Question
Discussion stats
  • 3 replies
  • 914 views
  • 0 likes
  • 2 in conversation