BookmarkSubscribeRSS Feed
tmm
Fluorite | Level 6 tmm
Fluorite | Level 6

I cannot get my chi data on my input to input right.

my code:

data chiin;

input comparison who$ svrty_lvl_cd svrty_lvl_desc admission$ count;

cards;

1111 NATIONAL 0 N/A      ADMIT   2995

1111 NATIONAL 0 N/A      READMIT 5

1111 1111     0 N/A      ADMIT   23

1111 1111     0 N/A      READMIT 1

1111 NATIONAL 1 MINOR    ADMIT   31697

1111 NATIONAL 1 MINOR    READMIT 52

1111 1111     1 MINOR    ADMIT   14

1111 1111     1 MINOR    READMIT 1

1111 NATIONAL 2 MODERATE ADMIT   42018

1111 NATIONAL 2 MODERATE READMIT 154

1111 1111     2 MODERATE ADMIT   9

1111 1111     2 MODERATE READMIT 1

1111 NATIONAL 3 MAJOR    ADMIT   7608

1111 NATIONAL 3 MAJOR    READMIT 19

1111 1111     3 MAJOR    ADMIT   3

1111 1111     3 MAJOR    READMIT 1     ;

run;

proc sort; by comparison descending admission;

run;

proc freq data=chiin order=data; by comparison;

weight count;

tables svrty_lvl_cd*svrty_lvl_desc*who*admission/chisq cmh fisher expected;

exact or;

output out=final or chisq;

run;

It will create the input table chiin but will put a . in the svrty_lvl_desc column.

Then when the rest of the code runs it gives me an error of:

invalid svrty_lvl_desc in line and names all the line numbers associated.

4 REPLIES 4
tmm
Fluorite | Level 6 tmm
Fluorite | Level 6

There is also no space between the first of my input and the 2nd line. It is just the inability to paste in this forum correctly and I cannot upload or attach files because the 1111 is not real. That space is actually a taxid number which is 9 digits long and I have to fake info I put on here because I work in healthcare and do not want to violate PHI or HIPPA laws. So I am never allowed to do any sort of attaching. I try and copy and paste but it does not always format right.

Reeza
Super User

Didn't you calculate this in a proc sql step or a data step separately?

Why do you need to read it in again?

tmm
Fluorite | Level 6 tmm
Fluorite | Level 6

Because it does not line up correctly in the proc sql step or data steps. All the input I have received from the SAS forums has not worked. So I exported the tables to Access and manually pulled from there what I need and now manually putting stuff in Excel to paste into SAS as a datain. I have a meeting at 1pm today to show CHI results and been spinning my wheels with input from the SAS forum for about 2wks and it has gotten down to the wire and I could no longer wait for help. So I have the first 60 TINS manually done now and ran and just pasted the data without the severity items and just did it by comparison, who, admission and count and that works out perfect. I will have to come back to figuring out how to add severity stuff and doing it based on a SAS table and code later. Right now it is about presenting findings and that is the most important. Hopefully someone on here can help me figure this out. If not I will be spinning my wheels for a longer amount of time

Reeza
Super User

If you have the data in an excel sheet, save it as CSV and then use proc import to read it in. You don't need any special license for that and don't have to

I'd highly suggest you either hire someone offline to help you get through this issue and get working with SAS though otherwise you're spinning your wheels on a lot of small problems...or take a course through SAS.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

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