12-11-2021
aabbccwyt
Obsidian | Level 7
Member since
09-25-2019
- 33 Posts
- 8 Likes Given
- 0 Solutions
- 0 Likes Received
-
Latest posts by aabbccwyt
Subject Views Posted 4328 12-11-2021 08:59 AM 4359 12-11-2021 08:38 AM 2218 11-14-2021 12:41 PM 2227 11-14-2021 12:37 PM 2467 11-14-2021 08:47 AM 2578 11-14-2021 05:17 AM 1030 11-07-2021 02:54 AM 3172 10-26-2021 09:19 AM 2109 10-18-2021 03:11 PM 2142 10-18-2021 02:55 PM -
Activity Feed for aabbccwyt
- Posted Re: Change variable names in PROC MEANS output on SAS Programming. 12-11-2021 08:59 AM
- Posted Change variable names in PROC MEANS output on SAS Programming. 12-11-2021 08:38 AM
- Posted Re: Converting height in ft.in (character) to inches (numeric) on SAS Programming. 11-14-2021 12:41 PM
- Posted Converting height in ft.in (character) to inches (numeric) on SAS Programming. 11-14-2021 12:37 PM
- Posted Re: Adding Leading Zero to Character Variable on SAS Programming. 11-14-2021 08:47 AM
- Posted Adding Leading Zero to Character Variable on SAS Programming. 11-14-2021 05:17 AM
- Liked Re: Unable to create a new variable in sas for Patrick. 11-07-2021 08:46 PM
- Liked Re: Unable to create a new variable in sas for Kurt_Bremser. 11-07-2021 08:46 PM
- Posted Unable to create a new variable in sas on SAS Programming. 11-07-2021 02:54 AM
- Liked Re: Single trailing @ in SAS for Kurt_Bremser. 10-26-2021 09:44 AM
- Liked Re: Single trailing @ in SAS for Tom. 10-26-2021 09:44 AM
- Liked Re: Single trailing @ in SAS for Amir. 10-26-2021 09:44 AM
- Posted Single trailing @ in SAS on SAS Programming. 10-26-2021 09:19 AM
- Liked Re: Using libname to read excel into SAS for Ksharp. 10-19-2021 09:40 PM
- Liked Re: Using libname to read excel into SAS for Patrick. 10-18-2021 04:43 PM
- Posted Re: Using libname to read excel into SAS on SAS Programming. 10-18-2021 03:11 PM
- Posted Using libname to read excel into SAS on SAS Programming. 10-18-2021 02:55 PM
- Liked Re: Using temporary array to score a test for Reeza. 10-18-2021 01:44 PM
- Posted Re: Using temporary array to score a test on SAS Programming. 10-18-2021 01:23 PM
- Posted Using temporary array to score a test on SAS Programming. 10-18-2021 01:08 PM
-
Posts I Liked
Subject Likes Author Latest Post 1 1 1 1 1
12-11-2021
08:59 AM
Hi,
Yes. I'm changing the label on the variables, that's what I mean and thank you for the clarification. And I want a table showing these labels. By output, I mean the table itself. I've been up pretty much all night and my head is in a mess. Sorry about that.
... View more
12-11-2021
08:38 AM
Hi all, I have the following code
proc sort data = work.final;
by Grades;
run;
proc means data = work.final maxdec = 2 nonobs;
class Grades;
var Emotionality;
output out = FS (drop = _FREQ_) N = mean = std = min = max = / autoname;
run;
proc sort data = work.FS;
by descending _TYPE_;
run;
Which gives me a table
I'm now trying to change the variable names with the following code
data FS(drop = _TYPE_);
set work.FS;
label Average_grades_in_school = 'Group' N = 'Count' Mean = 'Average' Std_Dev = 'Standard_Deviation';
run;
And it gives me the same output. Could anyone give me some advice? Thank you in advance!
... View more
11-14-2021
12:41 PM
Here is what I have for now
Height = compress(Height);
if findw(Height,'ft') > 0 then do;
ft = input(scan(Height,1,"ft"),f1.);
in = input(scan(Height,2,"in"),best.);
Height = 12*ft + 1*in;
else;
Height = Height;
end;
It gives errors but I'm just wondering if this is the right way to go or if there are easier ones.
... View more
11-14-2021
12:37 PM
Hi all,
I have some datasets
1 ft 1 in
2ft2in
3 in
4in
And I want to convert all of them to numeric variables in inches.
13
26
3
4
Could anyone tell me how to do it, please? I'm confused because they have different units and spaces. Any hints would be helpful. Thank you in advance!
... View more
11-14-2021
08:47 AM
Thank yall for your replies. The code
Zip_Code = put(input(Zip_Code, best12.), z5.);
is correct. I got it wrong because of a typo. I will accept @EyalGonen answer so the topic will be closed.
... View more
11-14-2021
05:17 AM
Hi all,
I'm setting the zip code to be a 5-digit character variable, and adding a leading zero if there are only 4 digits.
data survey;
infile '/home/uid/zip.csv' delimiter=',' missover firstobs=2 dsd;
format Zip_Code $5.;
input Zip_Code $; /* I've tried all 3 but none of them worked. */
Zip_Code = put(input(Zip_Code, best12.), z5.);
Zip_Code = put(Zip_Code, z5. -L);
Zip_Code = put(Zip_Code, z5.);
And the error comes out every time
Statement is not valid or it is used out of proper order.
Any hint or help? Thank you in advance!
... View more
11-07-2021
02:54 AM
Hi. I have the following code in SAS
data have;
input Make $ Model $ Type $ Origin $ DriveTrain $ MSRP Invoice;
datalines;
Acura MDX SUV Asia All 36945 33337
BMW X3 SUV Europe All 37000 33873
BMW 325i Sedan Europe All 52195 47720
Dodge Durango SUV USA All 32235 29472
Dodge Neon Sedan USA Front 13670 12849
;
pct_change = (MSRP - Invoice)/Invoice;
format pct_change percent10.;
where Type = "SUV" and DriveTrain = "All";
run;
proc print data = have;
title 'All wheel drive SUVs with less than 10% change in Price';
var Make Model MSRP Invoice pct_change;
where pct_change le 0.1;
run;
and I'm receiving the following errors
80 pct_change = (MSRP - Invoice)/Invoice;
__________
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
I don't know what I have done wrong and this should be a simple code so it really confused me. Any help? Thank you in advance!
... View more
10-26-2021
09:19 AM
This might be a basic question, I know the definition is
Single trailing is temporary, it is for the current iteration of the DATA step only.
But what exactly does it do? Does it mean to move to the next line at the end of the DATA step automatically or what else does it tell SAS to do?
Thank you in advance!
... View more
10-18-2021
03:11 PM
Hi. Now it comes with an error
ERROR: File HAVE.'Sheet1$'. DATA does not exist.
... View more
10-18-2021
02:55 PM
I'm using libname to read in excel into SAS
libname have xlsx '\\client\c$\SAS\File';
data need;
set have. 'Sheet1$';
And I'm receiving the following error
Error: The value 'SHEET1$'n is not a valid SAS name. Error 22-322: Syntax error, expecting one of the following: a name, a quoted string, ;, ... Error 201-322: The option is not recognized and will be ignored.
Any thoughts? Thank you in advance!
... View more
10-18-2021
01:23 PM
Hi,
It is wrong because I'm getting only 1 value for each student when I'm expecting 20 values.
To be more specific, here is what I have
... View more
10-18-2021
01:08 PM
data stan;
array Key[20] $ _temporary_ ('A','B','C','D','C','B','A','D','B','A','A','C','B','D','D','B','A','A','B','B');
array Question[20] $;
input Student_ID $ Gender $ Question[*];
Scores = 0;
do i = 1 to 20;
if Question[i] eq Key[i] then Scores = 1;
end;
drop i;
datalines;
A1 Female A B A D B C D A A A C D B C A C C B D A
A2 Female B C D A A A B C D A D C D B D A A D C D
A3 Male C C C A A B D B D B C D C D C A A D A A
A4 Male A D A C C C B D C A B A C A D D A B A C
;
proc print data = stan;
title "total correct questions by item";
var Student_ID Scores: ;
run;
I want to score a test for 4 people by using a temporary array. The outputs should show each grade for each student, indicated by a 1 or a 0. However, my current results are completely wrong. I think my problem comes from the proc print part but i don't know where it is wrong. Any help? Thanks in advance!
... View more
12-07-2019
01:27 AM
Hi,
I'm planning to take the certification exam by using a Mac which is prohibited. However, can I install a Windows system on my Mac and use the Windows system to take the exam? Thank you.
... View more
12-03-2019
11:30 PM
Hi Jag. Thank you again. I tried it however it is giving me the same thing. 112 /*Merge the two datasets*/
113 data NewAcctNum;
114 merge Location_Data Purchases;
ERROR: Variable AcctNum has been defined as both character and numeric.
115 by AcctNums;
116 run; I'm wondering if there is a way to specify whether it's character or numeric.
... View more
12-03-2019
11:14 PM
Hi, I'm trying to merge two datasets by the same variable AcctNums: data NewAcctNum;
set NewAcctNum;
merge Location_Data Purchases;
by AcctNums;
run; And it gives me "Variable AcctNum has been defined as both character and numeric.". I have already changed the variable AcctNum to a Numeric variable so I have no idea what I have done wrong. Can someone help please? Thank you. (It was a 1-1 merging.)
... View more