Hi all,
I am working on a college assignment and have imported an excel sheet that I have, which consists of these fields (as per the excel) . Here the discounted price shows as 176.63
However, in SAS it is different for some values - for example the same value is showing as Rs. 177663.00. It has not taken into account the 176.63.
This is is the code I used - which includes compressing it to remove the rupee sign, changing it from char to num. I have eventually formatted it to include ruppee sign.
main code:
data Amazon.Products_mod;
set Amazon.Products_Nodup;
A_Price= input(compress(actual_price, , 'kd'), comma10.);
put "Actual Price (numeric):" A_Price comma10.;
format A_Price currency_fmt.;
D_Price= input(compress(discounted_price, , 'kd'), comma12.);
put "Discounted Price (numeric):" D_Price comma12.;
format D_Price currency_fmt.;
rating_count_cmp = compress(rating_count);
rating_count_new = input(rating_count_cmp, comma12.);
* Dropping irrelevant values or old values that have been converted and replaced;
drop discounted_price rating_count_cmp rating_count img_link product_link actual_price;
run;
* including the INR sign;
proc format;
picture currency_fmt (round)
low-high = '₹' 00000009.00 (prefix='₹');
run;
It works fine with this code, but I need to add in the rupee sign to this.
Alternate code with the rupee sign included:
data Amazon1.Products_mod;
set Amazon1.Products_Nodup;
actual_price_cmp = compress(actual_price, "₹");
act_price = input(actual_price_cmp, comma15.);
discounted_price_cmp = compress(discounted_price, "₹");
disc_price= input(discounted_price_cmp, comma15.);
rating_count_cmp = compress (rating_count);
rating_count_new = input(rating_count_cmp, comma12.);
format disc_price currency
drop actual_price discounted_price actual_price_cmp discounted_price_cmp rating_count_cmp rating_count
img_link product_link;
run;
Any urgent suggestion on what can be done here and how i can get the right number + a comma for ease of readability.