SHARE
TWEET

Untitled

a guest May 22nd, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. libname cars '/home/u35108489/prob';
  2.  data work.cars;
  3.  set cars;
  4.  run;
  5.  
  6.  libname cars '/home/u35108489/prob';
  7.  proc copy in=work out=cars;
  8.  select cars;
  9. run;quit;
  10. proc print data=cars;
  11. run;
  12. /* 1) /
  13. data cars;
  14.     infile '/home/u35108489/prob/cars.txt' dsd;
  15.     input Id First_Name $ Last_Name $ Salary Resident $ CarMark $;
  16. run;
  17.  
  18. / 2) /
  19. title "Lista angajatilor cu salariul mai mic de 10";
  20. proc print data = cars;
  21.         where Salary < 10;
  22.         var Id Last_Name First_Name Salary;
  23. run;
  24.  
  25. / 3) /
  26.  
  27. title "Lista proprietarilor care detin Audi cu salariul marit";
  28. data cars1;
  29. set cars;
  30.         where CarMark eq 'Audi';
  31.         Salary = Salary1.1;
  32. proc print data=cars1;
  33. run;
  34.  
  35.  
  36. /* 4) */
  37. libname cars '/home/u35108489/prob';
  38.  data work.cars;
  39.  set cars;
  40.  run;
  41.  
  42. ---------------------------------------------------
  43.  libname cars '/home/u35108489/prob';
  44.  proc copy in=work out=cars;
  45.  select cars;
  46. run;quit;
  47. proc print data=cars;
  48. run;
  49. pip install pandas
  50. import pandas as pd
  51.  
  52. # 1
  53. dataframe = pd.read_csv("angajati4p.csv")
  54. #print(dataframe)
  55. dataframe = dataframe.values
  56.  
  57. # 2
  58. for line in dataframe:
  59.     if line[3] > 90 and line[5] == "Female":
  60.         print("{} {} {} {} {}".format(line[0], line[1], line[2], line[3], line[5]))
  61.         print(f"{line[0]} {line[1]} {line[2]} {line[3]} {line[5]}")
  62.  
  63. # 3
  64. for line in dataframe:
  65.     if "Ro" in line[1] or "Ro" in line[2]:
  66.         print("{} {} {}".format(line[0], line[1], line[2]))
  67.  
  68. # 4
  69. salarii = [x[3] for x in dataframe]
  70. mean_salarii = float(sum(salarii))/len(salarii)
  71. #print(mean_salarii)
  72.  
  73. new_data = [x for x in dataframe if x[3] > mean_salarii]
  74. new_data = pd.DataFrame(new_data)
  75.  
  76. new_data.to_csv("output.csv", sep=",", index=False)
  77. dataframe.remove(dataframe[2])
  78. dataframe = np.delete(dataframe, 5,1)
  79. for line in dataframe:
  80.     if line[3] < 10:
  81.         dataframe.remove(line)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top