BookmarkSubscribeRSS Feed
PU1
Calcite | Level 5 PU1
Calcite | Level 5
data STOCK;
infile
'/folders/myfolders/exdata/annual_stock_price.txt';
input year $ stock1 stock2 stock3 stock4 stock5 stock6 stock7 stock8 stock9
stock10 stock11 stock12 stock13 stock14 stock15 stock16 stock17 stock18 stock19
stock20;
run;
PROC PRINT DATA = STOCK;
RUN;
data STOCK1;
set STOCK;
label stock1 ='Microsoft'
stock2 ='Apple Inc'
stock3 ='Walmart'
stock4 ='BJ'
stock5 ='Costco'
stock6 ='3M'
stock7 ='Eli Lilly'
stock8 ='Pfizer'
stock9 ='Exelon'
stock10='Toyota'
stock11='Ford'
stock12='GM'
stock13='American Airline'
stock14='Johnson & Johnson'
stock15='Exxon'
stock16='Georgia Pacific'
stock17='American Standard'
stock18='Northrop Gruman'
stock19='Sears'
stock20='Peco';
6 REPLIES 6
Shmuel
Garnet | Level 18

Any data step or sas procedure should end by  run;

 

It seems to me that you want:

data STOCK;
infile
'/folders/myfolders/exdata/annual_stock_price.txt';
input year $ stock1 stock2 stock3 stock4 stock5 stock6 stock7 stock8 stock9 stock10 
stock11 stock12 stock13 stock14 stock15 stock16 stock17 stock18 stock19 stock20; label stock1 ='Microsoft' stock2 ='Apple Inc' stock3 ='Walmart' stock4 ='BJ' stock5 ='Costco' stock6 ='3M' stock7 ='Eli Lilly' stock8 ='Pfizer' stock9 ='Exelon' stock10='Toyota' stock11='Ford' stock12='GM' stock13='American Airline' stock14='Johnson & Johnson' stock15='Exxon' stock16='Georgia Pacific' stock17='American Standard' stock18='Northrop Gruman' stock19='Sears' stock20='Peco'
; run; PROC PRINT DATA = STOCK; RUN;
PU1
Calcite | Level 5 PU1
Calcite | Level 5
Thank you so much I need coding for percentage
Kurt_Bremser
Super User

Please be more specific. Percentage describes a relationship between two values. Which values should be used for the calculation?

Also post the code you already have, and where the result diverges from your intended result.

 

We are here to help you achieve something, not to help you in being lazy.

LinusH
Tourmaline | Level 20
Sorry, still not clear about what want to do.
Perhaps you have a colleague or friend that can help you describe the issue a bit mor fully bodied?
Data never sleeps

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

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
  • 6 replies
  • 855 views
  • 0 likes
  • 4 in conversation