BookmarkSubscribeRSS Feed
jerry898969
Pyrite | Level 9
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
3 REPLIES 3
Peter_C
Rhodochrosite | Level 12
add a line just before the input statement[pre] ID+1 ;[/pre]
good Luck

PeterC
jerry898969
Pyrite | Level 9
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
jerry898969
Pyrite | Level 9
Nevermind I figured it out $20. fixed it in the input statement.

Thanks again for the help
Jerry

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 3033 views
  • 0 likes
  • 2 in conversation