BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
amounikareddy28
Calcite | Level 5

Hello, I just started learning SAS and I need to create a temporary dataset 'distance' using the following data.
Miles = 26.22;
Kilometers = 1.61 * Miles.

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

That's close! I have modified the code so that I think it will work

 

data distance;
Miles=26.22;
Kilometers=1.61*Miles;
run;

proc print data = distance;
run;

You don't need an INPUT statement unless you plan to read data from somewhere (a file, or a CARDS or DATALINES statement)

 

 

--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Show us what you have tried.

--
Paige Miller
amounikareddy28
Calcite | Level 5

data distance;
input Miles Kilometers;
if Miles=26.22 then Kilometers=(1.61*Miles);
run;

proc print data = distance;
run;

 

 

PaigeMiller
Diamond | Level 26

That's close! I have modified the code so that I think it will work

 

data distance;
Miles=26.22;
Kilometers=1.61*Miles;
run;

proc print data = distance;
run;

You don't need an INPUT statement unless you plan to read data from somewhere (a file, or a CARDS or DATALINES statement)

 

 

--
Paige Miller
amounikareddy28
Calcite | Level 5

Thank you so much for your help. Thank you for teaching me!

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 1620 views
  • 0 likes
  • 2 in conversation