Hi all,
can any one know the format for this
i have the dataset like this
product amount
account value
fixed 1,52,132
variable 2,50,478
annual rate
product 4.5%
variable 5.6%
this over all is one dataset.
i have read this data from excel using libname statement.
and the variable amount is in character type.
now i have to convert the data i.e. amount into numeric.
can any one know the process please comment.
Is all of this in one column (variable) in the SAS data set? If so this is likely to be a mess. SAS can only have one characteristic per variable, either numeric or character. So you will have to create new variables using a data step. You may need to provide a bit more data for input example AND an example of what the output should look like.
It looks like you actually have 3 values for the rows that start with Fixed and Variable, is that the actual case? or did we lose something in pasting into the forum?
Read the column into a char variable, then check that variable for its layout and select the proper conversion.
It would be nice if you could provide an example of the data in csv form, so that we can determine the actual positioning of the data in the cells.
(ie is "product amount" in one or 2 cells?)
Am linking this thread: https://communities.sas.com/thread/75128
Here, as its exactly the same question.
data have; input p $ a : $20.; cards; fixed 1,52,132 variable 2,50,478 product 4.5% variable 5.6% ; run; data want; set have; length fmt $ 20; if findc(a,',') then fmt='comma32.'; else if findc(a,'%') then fmt='percent12.'; else fmt='best32.'; v=inputn(a,fmt); run;
Xia Keshan
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!
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.