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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register 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
  • 3638 views
  • 0 likes
  • 2 in conversation