NUMERIC FUNCTIONS IN SAS | SAS TUTORIAL FOR BEGINNERS VIDEOS 8
Vložit
- čas přidán 21. 08. 2024
- SAS has a wide variety of in built functions which help in analysing and processing the data. These functions are used as part of the DATA statements. They take the data variables as arguments and return the result which is stored into another variable. Depending on the type of function, the number of arguments it takes can vary. Some functions accept zero arguments while some other accept fixed number of variables. Below is a list of types of functions SAS provides.
romba thanks mam
everything is good, but yawning in between the video is not okay!! 😇
Hello ma’am, may I request for the notes or a textbook used in this course?
Pls try to do classes in teluguu
mam i have one question , i used month=month(date) function to get the month value and it returns value from 1-12 representing each month. i want to print these 1-12 values as months like jan feb by using a inbuilt format monname. , but when i am using it its only printing January for each value. how can i resolve this.
here is the code.
data med;
date=today();
day=weekday(date);
month=month(date);
format month monname. day Downame.; ------ in output only january is getting printed-----
run;
Dear Rajat always placed format step immediate after data step
@@Trenovision in proc step also .. it's same issue. Only January is getting printed
Dear Rajat date, month and day formats can be applied only to the date type values but if you see your code day n month don't have date type values. You can try any of below codes to get the desired output.
data med;
format date date9. month monname. day Downame.;
date=today();
day=today();
month=today();
run;
or
data med;
format date date9. month monname. day Downame.;
date=today();
day=date;
month=date;
run;
or you want to do your way then you can define values by using proc format.
@@Trenovision thank you mam i got your point ,,, its kind of confusing actually , that i am able to print weekday information by downame. fornmat but when i am trying the monname. on month=month(); its printing january only. issue is resolved if i used monname. on date
How to find the position of 2 blank spaces in the dataset?
datalines;
kamireddy jagan Reddy
adithya desh pandey
rajat kumar madaan
julee bharatkumar thanki
;
run;
Use index() function to find 2 blank spaces it will return the position.
@@Trenovision I tried that but unable to find the exact result. Can you provide the solution for the same?
@@TheVaibhavdang You can also use scan() function if you're trying to extract first, middle and last name.
@@Trenovision Thats the thing but I just want to find the second blank right now,so that I can perform multiple operations
You can refer this to solve your issue.
blogs.sas.com/content/sgf/2019/06/26/finding-n-th-instance-of-a-substring-within-a-string/#:~:text=Here%20is%20how%20you%20can,1%20from%20right%20to%20left.
data Name;
input Fname $ 30.;
a=propcase(Fname);
d=substr(a,index(a,' '),length(a));
newVar=substr(a,1,1)||'.'||d;
drop a d;
datalines;
kamireddy jagan Reddy
adithya desh pandey
rajat kumar madaan
julee bharatkumar thanki
;
run;
proc contents data=name;
run;
i created this program before checking your solution ,, i could not reduced NewVar length from 61. you said max should be 50.
Try this to reduce default length of newly created variable.
DATA NAME;
FORMAT NEWVAR $50.;
INPUT FNAME $30.;
madam, i have one question.
how do i total in a particular column(Variable) ?
e.g=
data mka;
input pid$ sp1-sp10;
cards;
Ab 23 45 65 74 85 96 12 42 62 85
cd 25 32 45 70 20 60 32 45 15 65
ef 02 32 12 45 65 95 75 85 25 15
gh 45 65 15 75 42 62 21 26 58 69
ik 58 65 45 85 96 45 12 20 30 40
;
run;
We didn't get your question, you can sum using aggregation in proc sql for a particular column.
@@Trenovision i understood