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

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 4198 views
  • 0 likes
  • 2 in conversation