I am trying to create a z score function so that it can be used repeatedly anytime I want to calculate the z score. I know how to calculate the z score, the only problem I have is to make it a function that can be reused. I am using the cars data set which I will attach to this question. First I created a library named ztest and imported the dataset; libname ztest "\Users\Ifeoma\Downloads\newsas"; proc import datafile = "C:\Users\Ifeoma\Downloads\cars.xlsx" out = ztest.zscore dbms = xlsx replace; getnames = yes; run; Here is my code for calculating z score which worked. data test(keep = length horsepower mpg_city); set ztest.zscore; run; proc standard data = test mean = 0 std = 1 out = z_test; var length horsepower mpg_city; run; The data set WORK.Z_TEST has 421 observations and 3 variables. NOTE: PROCEDURE STANDARD used (Total process time): real-time 0.01 seconds CPU time 0.01 seconds Here is my code to create a z score function which did not work; proc fcmp outlib = ztest.test; function get_z(length, horsepower , mpg_city); proc standard data = test mean = 0 std = 1 out = z_test; var length horsepower mpg_city; run; options cmplib=ztest.test; score = get_z(length, horsepower , mpg_city); put score = ; Here is the error I got; NOTE: No CMP or C functions found in library ztest.test. 70 function get_z(length, horsepower , mpg_city); ERROR: Subroutine 'get_z' was not terminated with ENDSUB. NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE FCMP used (Total process time): real-time 0.07 seconds CPU time 0.04 seconds Is there a way to correct this procedure or is there another procedure to use?
... View more